source: trunk/client/temi/realistic/layout/scripts/superfish/jquery.hoverIntent.js@ 407

Last change on this file since 407 was 241, checked in by luc, 9 years ago

Aggiunta del widget Privacy e CookieLaw per l'informativa sui cookie - Aggiunto Tema Realistic - Aggiunto Tema Spectral

  • Property svn:executable set to *
File size: 2.4 KB
Line 
1/*!
2 * hoverIntent v1.8.1 // 2014.08.11 // jQuery v1.9.1+
3 * http://cherne.net/brian/resources/jquery.hoverIntent.html
4 *
5 * You may use hoverIntent under the terms of the MIT license. Basically that
6 * means you are free to use hoverIntent as long as this header is left intact.
7 * Copyright 2007, 2014 Brian Cherne
8 */
9
10/* hoverIntent is similar to jQuery's built-in "hover" method except that
11 * instead of firing the handlerIn function immediately, hoverIntent checks
12 * to see if the user's mouse has slowed down (beneath the sensitivity
13 * threshold) before firing the event. The handlerOut function is only
14 * called after a matching handlerIn.
15 *
16 * // basic usage ... just like .hover()
17 * .hoverIntent( handlerIn, handlerOut )
18 * .hoverIntent( handlerInOut )
19 *
20 * // basic usage ... with event delegation!
21 * .hoverIntent( handlerIn, handlerOut, selector )
22 * .hoverIntent( handlerInOut, selector )
23 *
24 * // using a basic configuration object
25 * .hoverIntent( config )
26 *
27 * @param handlerIn function OR configuration object
28 * @param handlerOut function OR selector for delegation OR undefined
29 * @param selector selector OR undefined
30 * @author Brian Cherne <brian(at)cherne(dot)net>
31 */
32
33(function(e){e.fn.hoverIntent=function(t,n,r){var i={interval:100,sensitivity:6,timeout:0};if(typeof t==="object"){i=e.extend(i,t)}else if(e.isFunction(n)){i=e.extend(i,{over:t,out:n,selector:r})}else{i=e.extend(i,{over:t,out:t,selector:n})}var s,o,u,a;var f=function(e){s=e.pageX;o=e.pageY};var l=function(t,n){n.hoverIntent_t=clearTimeout(n.hoverIntent_t);if(Math.sqrt((u-s)*(u-s)+(a-o)*(a-o))<i.sensitivity){e(n).off("mousemove.hoverIntent",f);n.hoverIntent_s=true;return i.over.apply(n,[t])}else{u=s;a=o;n.hoverIntent_t=setTimeout(function(){l(t,n)},i.interval)}};var c=function(e,t){t.hoverIntent_t=clearTimeout(t.hoverIntent_t);t.hoverIntent_s=false;return i.out.apply(t,[e])};var h=function(t){var n=e.extend({},t);var r=this;if(r.hoverIntent_t){r.hoverIntent_t=clearTimeout(r.hoverIntent_t)}if(t.type==="mouseenter"){u=n.pageX;a=n.pageY;e(r).on("mousemove.hoverIntent",f);if(!r.hoverIntent_s){r.hoverIntent_t=setTimeout(function(){l(n,r)},i.interval)}}else{e(r).off("mousemove.hoverIntent",f);if(r.hoverIntent_s){r.hoverIntent_t=setTimeout(function(){c(n,r)},i.timeout)}}};return this.on({"mouseenter.hoverIntent":h,"mouseleave.hoverIntent":h},i.selector)}})(jQuery)
Note: See TracBrowser for help on using the repository browser.