I'm using this animate jQuery code:
$('.tabs').hover(
function(){
$('#tabs-wrap').animate({marginTop: '+=147'}, 500);
$('.tabs li a').delay(250).animate({height: '150'}, 500);
},
function(){
$('.tabs li a').animate({height: '40'}, 500);
$('#tabs-wrap').delay(250).animate({marginTop: '-=147'}, 500);
}
);
But is it possible to only start animating if the user has the mouse hovered for a certain amount of time (to stop the effect if the they just swipe the mouse of rather than intentionally activating it)
开发者_开发知识库Thanks!
Check out the hoverIntent plugin, basically it uses setTimeout to invoke the function after x millseconds, the timeout is cancelled if they user mouse outs.
精彩评论