2013-08-06 49 views

回答

19

這是因爲你的動畫最大1000像素介於0和高度,但內容只有大約120像素高。延遲是在您無法看到的880像素上發生的動畫。

將max-height設置爲您的內容的已知高度(如果您知道它 - 例如:http://jsbin.com/onihik/1/)或嘗試其他方法。可能像https://stackoverflow.com/a/6486082/2619379

+1

很好的解釋爲什麼會發生延遲! – Jupo

17

Fixed JS Bin

修復延遲溶液:

將立方貝塞爾(0,1,0,1)過渡爲元件的功能。

.text { 
    overflow: hidden; 
    max-height: 0; 
    transition: max-height 0.5s cubic-bezier(0, 1, 0, 1); 
    &.full { 
    max-height: 1000px; 
    transition: max-height 1s ease-in-out; 
} 
+0

謝謝!好的解決方案 – Alex

+0

和這個一起去!偉大的解決方案,謝謝 – Jupo

+0

真棒解決方案。應該是被接受的答案。 – MadOgre