2011-05-09 83 views
0

好的,所以我试图使用hoverIntent来动画一些社交网络图标,我在我的页面的其他部分使用了hoverIntent,并且它工作正常。我没有收到错误消息,只是没有发生任何事情!为什么我的.hoverIntent动画背景位置不起作用?

   $("ul.social-networks li.flickr").each(function(index) { 
       $(this).hoverIntent(
        function() { 
         $(this).animate({backgroundPosition: "(-84px -28px)"}, 
         {duration:200}); 
        }, 
        function() { 
         $(this).animate({backgroundPosition: "(-84px 0px)"}, 
         {duration:200}); 
        }); 
       console.debug($(this)); 
      }); 

回答

2

hoverIntent既需要在进出功能:

$(document).ready(function(){ 
    $(".tag").hoverIntent({ 
     over: onHoverFunction, 
     timeout: 500, // believe time in milliseconds 
     out: onLeaveFunction 
    }); 

}); // close document.ready 

function onHoverFunction(){ 
    // Code 
} 
function onLeaveFunction(){ 
    // Code 
}