我有以下一段代码正在从点击功能运行。由于某些原因,动画降至100px的部分从不运行console.log
或my_function()
,它会跳过您放置在那里的任何内容。动画高达200px的部分都运行良好。是什么赋予了?动画后跳过jQuery功能
if($(this).hasClass('open'))
{
$(this).removeClass('open').addClass('closed');
$(this).animate({'width': '100px'}, {queue:false, duration:150, easing: 'linear'}).delay(160, function(){
//Nothing in here ever get run??
console.log('closed');
my_function();
});
}
else
{
$(this).removeClass('closed').addClass('open');
$(this).animate({'width': '200px'}, {queue:false, duration:200, easing: 'linear'}).delay(210, function(){
console.log('opened');
my_function();
});
}
我也在想这个 - 但他说else语句有效。但我无法理清为什么这样做会奏效。有什么想法吗? – mrtsherman 2012-01-09 16:05:36
我不认为这是可能的。 jsFiddle即将推出 – 2012-01-09 16:07:04
这是一个小提琴。它确实触发了一个console.log http://jsfiddle.net/Tentonaxe/tRUBr/ – 2012-01-09 16:09:42