我想顯示/隱藏使用jQuery左至右一段文字。jQuery的動畫slideLeft沒有文字環繞
我使用
$('#text').animate({
width: ['toggle', 'swing']
});
但是我看到,該段包裝作爲動畫正在發生的事情。它看起來很醜。
爲的不期望的效果的例子參見this js fiddle。
你怎麼會建議得到同樣的效果,但沒有包裝? (像.slideUp()
/slideDown()
)...
感謝所有幫助
我想顯示/隱藏使用jQuery左至右一段文字。jQuery的動畫slideLeft沒有文字環繞
我使用
$('#text').animate({
width: ['toggle', 'swing']
});
但是我看到,該段包裝作爲動畫正在發生的事情。它看起來很醜。
爲的不期望的效果的例子參見this js fiddle。
你怎麼會建議得到同樣的效果,但沒有包裝? (像.slideUp()
/slideDown()
)...
感謝所有幫助
您需要設置overflow: hidden
在容器上,然後將動畫應用於容器。
試試這個:
CSS:
#wrap{
width:200px;
overflow: Hidden;
}
#text{
width:200px;
}
腳本:
setTimeout(
function(){
$('#wrap').animate(// Changed to slide the wrap instead of the #text
{
width: ['toggle', 'swing']
})
},
1000);