2012-03-20 20 views
0

我有这样的代码:如何立即跳转到jQuery中的回调?

$('#banner .bg_wrap:first').stop().animate({ 
       opacity: 0 
      }, 500, function(){ 
       $(this).remove(); 
      }); 

现在,请大家帮帮忙,我要的是立即跳转到,如果用户将鼠标悬停越快回调函数。谢谢。

回答

0

你可以做这样的事情:

$('#banner .bg_wrap:first').stop().animate({ 
      opacity: 0 
     }, 500, callbackFunction); 

$('#banner .bg_wrap:first').bind("mouseover", callbackFunction); 

function callbackFunction(){ 
      if (this) $(this).remove(); 
}