0

我有这个代码:

.wrapper {
width: 100%;
height: 300px;
}
.wrapper > div {
width: 50%;
height: 100%;
position: absolute;
z-index: 1;
}
.wrapper > div img {
display: block;
width: 600px;
height: 600px;
margin: 5% auto 0px auto;
}
.wrapper > div:hover {
width: 100%;
left: 0;
z-index: 2;
transition-property: all;
transition-duration: .5s;
transition-timing-function: ease;
}
.left {
background: #000000;
left: 0;
}
.right {
background: #ffffff;
right: 0;

当您将鼠标悬停在左侧时,它会执行应有的操作,但是当您将鼠标悬停在右侧时,它会变得疯狂并且不起作用,知道为什么吗?

编辑:我链接了错误的 JSFiddle,这是正确的:http: //jsfiddle.net/TjJrs/

4

1 回答 1

0

删除left: 0;

.wrapper > div:hover {

    width: 100%;
    /*left: 0;*/ 
    z-index: 2;
    transition-property: all;
    transition-duration: .5s;
    transition-timing-function: ease;
}

演示

于 2013-09-26T23:11:28.920 回答