var foo = $("div").bind("click", function() {
$("div").animate({"height" : "500px"}, 2000);
$("div").animate({"height" : "50px"}, 2000);
$("div").unbind();
});
问问题
838 次
2 回答
3
你可以这样做:
function handler() {
$(this)
.unbind()
.animate({"height" : "500px"}, 2000);
.animate({"height" : "50px"}, 2000, function(){
$(this).click(handler); // <- gets called once the animation finishes
});
}
$('div').click(handler);
于 2011-06-01T08:16:10.823 回答
2
您可以在 animate 函数的回调中重新绑定它:
于 2011-06-01T08:17:46.313 回答