//下拉菜单延迟插件
(function($){
$.fn.hoverDelay = function(options){ 蓝狮注册开户
var defaults = {
hoverDuring: 120,
outDuring: 120,
hoverEvent: function(){
$.noop();
},
outEvent: function(){
$.noop();
}
};
var sets = $.extend(defaults,options || {});
var hoverTimer, outTimer, that = this;
return $(this).each(function(){
$(this).hover(function(){
clearTimeout(outTimer);
hoverTimer = setTimeout(function(){sets.hoverEvent.apply(that)}, sets.hoverDuring);
},function(){
clearTimeout(hoverTimer);
outTimer = setTimeout(function(){sets.outEvent.apply(that)}, sets.outDuring);
});
});
}
})(jQuery);
//主导航下拉菜单延迟实例化
$(function(){
$(“.J_nav”).each(function(e) {蓝狮注册
var that = $(this);
that.hoverDelay({
hoverEvent: function(){
//that.find(“a:first”).addClass(“hov”);
that.find(“.show-nav”).show();
}
});
that.hoverDelay({
outEvent: function(){
that.find(“.show-nav”).hide();
//that.find(“a:first”).removeClass(“hov”);
}
});
});
});
标签:延时程序
0 Comments