Jquery实现延迟加载数据

(function($){
    $.fn.hoverDelay = function(options){
        var defaults = {
            hoverDuring: 150,
            outDuring: 1,
            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);

 

 

$(selector).hoverDelay({
			hoverEvent: function(){		
			alert("我来晚了,不好意思啊!");						
						
			}
		});



 

你可能感兴趣的:(Jquery实现延迟加载数据)