jquery hoverIntent 插件介绍
hoverIntent jQuery Plug-in
hoverIntent is a plug-in that attempts to determine the user's intent... like a crystal ball, only with mouse movement! It is similar to jQuery's hover method. However, instead of calling the handlerIn function immediately, hoverIntent waits until the user's mouse slows down enough before making the call.
Why? To delay or prevent the accidental firing of animations or ajax calls. Simple timeouts work for small areas, but if your target area is large it may execute regardless of intent. That's where hoverIntent comes in...
hoverIntent是一个插件, 当用户鼠标移动时, 能够试图确定用户的意图, hoverIntent会等待用户的鼠标慢下来, 才去调用javascript。
<!-- DEMO JS --> <script type="text/javascript" charset="utf-8"> $(document).ready(function(){ $("#demo1 li").hover(makeTall,makeShort); $("#demo2 li").hoverIntent(makeTall,makeShort); $("#demo3 li").hoverIntent(toggleHeight); $("#demo4").hoverIntent(makeTall,makeShort,'li'); $("#demo5").hoverIntent(toggleHeight,'li'); $("#demo6").hoverIntent({ over: makeTall, out: makeShort, selector: 'li' }); }); // close document.ready function makeTall(){$(this).animate({"height":75},200);} function makeShort(){$(this).animate({"height":50},200);} function toggleHeight(){var h=(parseInt($(this).css('height'),10) > 50) ? 50 : 75; $(this).animate({"height":h},200);} </script>
https://github.com/briancherne/jquery-hoverIntent
相关推荐
EdwardSiCong 2020-11-23
85477104 2020-11-17
hhanbj 2020-11-17
81427005 2020-11-11
seoppt 2020-09-13
honeyth 2020-09-13
WRITEFORSHARE 2020-09-13
84483065 2020-09-11
momode 2020-09-11
85477104 2020-08-15
83510998 2020-08-08
82550495 2020-08-03
tthappyer 2020-08-03
84901334 2020-07-28
tthappyer 2020-07-25
TONIYH 2020-07-22
tztzyzyz 2020-07-20
83510998 2020-07-18
81463166 2020-07-17