有時候我們會使用一些動態效果,比如將div動態邊長、縮短之類的,這需要使用jquery中的animate()方法,比如:
Animate Reset
這裡說一下它的回撥函式,如果要想在animate()執行完之後才進行某個操作,直接在這個方法後面再進行操作是不行的,必須在它的回撥函式中進行,比如:
$(".b1").click(function(){ $("#item").animate({height:"200px"}, function() { alert("hello"); }); });
這樣才能在animate()執行完之後彈出alert(「hello」)。
[admin via ] jquery中的動畫效果方法animate()及其回撥函式的使用已經有397次圍觀