您的位置:首页 > Web前端 > JQuery

Jquery实现延迟加载数据

2012-11-18 21:33 411 查看
(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("我来晚了,不好意思啊!");						
						
			}
		});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: