标签:事件 test class ret return during timer each clear
(function($){ $.fn.hoverDelay = function(options){ var defaults = { hoverDuring: 200, outDuring: 200, hoverEvent: function(){ $.noop(); }, outEvent: function(){ $.noop(); } }; var sets = $.extend(defaults,options || {}); var hoverTimer, outTimer; return $(this).each(function(){ $(this).hover(function(){ clearTimeout(outTimer); hoverTimer = setTimeout(sets.hoverEvent, sets.hoverDuring); },function(){ clearTimeout(hoverTimer); outTimer = setTimeout(sets.outEvent, sets.outDuring); }); }); } })(jQuery);
实现
$("#test").hoverDelay({ hoverEvent: function(){ alert("经过我!"); } });
标签:事件 test class ret return during timer each clear
原文地址:http://www.cnblogs.com/qianxinxu/p/6478249.html