WordPress/wp-includes/js/hoverIntent.min.js

1 line
1.1 KiB
JavaScript

!function(a){a.fn.hoverIntent=function(e,t,n){function r(e){o=e.pageX,v=e.pageY}var o,v,i,u,s={interval:100,sensitivity:7,timeout:0},s="object"==typeof e?a.extend(s,e):a.isFunction(t)?a.extend(s,{over:e,out:t,selector:n}):a.extend(s,{over:e,out:e,selector:t}),h=function(e,t){if(t.hoverIntent_t=clearTimeout(t.hoverIntent_t),Math.abs(i-o)+Math.abs(u-v)<s.sensitivity)return a(t).off("mousemove.hoverIntent",r),t.hoverIntent_s=1,s.over.apply(t,[e]);i=o,u=v,t.hoverIntent_t=setTimeout(function(){h(e,t)},s.interval)},t=function(e){var n=jQuery.extend({},e),o=this;o.hoverIntent_t&&(o.hoverIntent_t=clearTimeout(o.hoverIntent_t)),"mouseenter"==e.type?(i=n.pageX,u=n.pageY,a(o).on("mousemove.hoverIntent",r),1!=o.hoverIntent_s&&(o.hoverIntent_t=setTimeout(function(){h(n,o)},s.interval))):(a(o).off("mousemove.hoverIntent",r),1==o.hoverIntent_s&&(o.hoverIntent_t=setTimeout(function(){var e,t;e=n,(t=o).hoverIntent_t=clearTimeout(t.hoverIntent_t),t.hoverIntent_s=0,s.out.apply(t,[e])},s.timeout)))};return this.on({"mouseenter.hoverIntent":t,"mouseleave.hoverIntent":t},s.selector)}}(jQuery);