root / tei / js / jquery.hoverIntent.min.js @ 2
Historique | Voir | Annoter | Télécharger (1,53 ko)
1 | 2 | mingarao | /*******************************************************************************
|
---|---|---|---|
2 | 2 | mingarao | jquery.mb.components
|
3 | 2 | mingarao | Copyright (c) 2001-2010. Matteo Bicocchi (Pupunzi); Open lab srl, Firenze - Italy
|
4 | 2 | mingarao | email: mbicocchi@open-lab.com
|
5 | 2 | mingarao | site: http://pupunzi.com
|
6 | 2 | mingarao | |
7 | 2 | mingarao | Licences: MIT, GPL
|
8 | 2 | mingarao | http://www.opensource.org/licenses/mit-license.php
|
9 | 2 | mingarao | http://www.gnu.org/licenses/gpl.html
|
10 | 2 | mingarao | ******************************************************************************/
|
11 | 2 | mingarao | |
12 | 2 | mingarao | (function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery); |