jquery延时处理
(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); function kbn_tag_delay (name1, name2) { $(''+name2).hoverDelay({ hoverEvent: function(){ $(''+name2).css('display','none'); $(''+name1).slideDown('slow'); } }); $(''+name1).mouseleave(function(){ $(''+name1).css('display','none');//.siblings().css('display','block'); // $(''+name2).slideDown('slow'); $(''+name2).css('display','block'); //$('#tb2').css('display','block'); }) ; } kbn_tag_delay('#tb1','#tb2');
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17