Javascript错误:...不是功能
我想要做的是,动画和隐藏一些div,在closelink按钮点击,然后隐藏此按钮。功能的作品,但不隐藏closer_div
和FF给出错误信息Javascript错误:...不是功能
ftr_form_cntr.stop(true, true).animate({height: "0"}, 1000).pause is not a function
。其实它所有的操作都是非常重要的。这条线closer_div.hide();
。功能看起来像
$(closer_link).click(function() {
ftr_form_cntr.find("div").fadeOut();
ftr_form_cntr.stop(true, true).animate({height:"0"},1000).pause(2000).hide();
closer_div.hide();
});
animate函数确实有完成的动画时将触发一个回调函数,请参见下面的代码:
ftr_form_cntr.stop(true, true).animate({height:"0"},1000, function(){
$(this).hide();
})
什么,你也可以做,如果你想有一个0的高度,然后隐藏起来。使用.slideUp()
函数,该函数还具有回调函数。
ftr_form_cntr.stop(true, true).slideUp(1000);
如果你想别的动画,等待1秒,做一些事情,这样做:
ftr_form_cntr.stop(true, true).animate({height:"0"},1000, function(){
var _this = $(this);
setTimeout(function(){
_this.hide();
}, 1000);
})
另一种选择可以是.delay()
,它等待2秒。
ftr_form_cntr.stop(true, true).animate({height:"0"},1000).delay(2000).hide();
好的解决了我的问题。还有一个Q.我可以结合这两个操作吗? 'ftr_form_cntr.find( “DIV”)淡出(); ftr_form_cntr.stop(true,true).slideUp(1000);' –
你在吗?嗯?... –
尝试使用:$('#element')。animate({opacity:0,height:'hide'},1000); – Niels
错误消息说这一切......'暂停'不是一个函数。你的意思是“延迟”吗? –