2013-09-26 42 views
0

我有這樣的代碼:爲什麼這個CSS3轉換隻能在一邊工作?

.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/

+0

它的工作原理...懸停藍色擴大向右......並將紅色展開到左側..這就是對的? – aldanux

+0

可能是因爲你已經指定了'left'屬性爲0.嘗試'left:100%'首先而不是'right',看看它是否有效 – JofryHS

+0

小提琴在哪裏去了? – aldanux

回答

0

中刪除left: 0;

.wrapper > div:hover { 

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

DEMO

相關問題