javascript - add delay on hover - menu jquery -


my problem is: if go 2014 dec , mouse passes over 2015, year changes 2015.i need add small delay year stays 2014.

here jsfiddle demo demo link note: hover on past events.

$(".dropdown-menu > li > a.trigger").on("mouseover",function(e){     var current=$('.dropdown-menu > li > a.trigger').next();     var grandparent=$('.dropdown-menu > li > a.trigger').parent().parent();     if($('.dropdown-menu > li > a.trigger').hasclass('left-caret')||$('.dropdown-menu > li > a.trigger').hasclass('right-caret'))         $('.dropdown-menu > li > a.trigger').toggleclass('right-caret left-caret');         grandparent.find('.left-caret').toggleclass('right-caret left-caret');         grandparent.find(".sub-menu:visible").hide();         current.fadein(200);     e.stoppropagation(); }); 

try along these lines.

var selected = null; var queued = null; $(".dropdown-menu > li > a.trigger").on("mouseover", function (e) {     if (selected !== this) {         addqueue(this);     } else {         // rest of code!     } });  function addqueue($el) {     queued = $el;     settimeout(function () {         if (queued === $el) {             selected = $el;             $el.trigger('mouseover');         }     }, 500); } 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - Bypass Geo Redirect for specific directories -

php - .htaccess mod_rewrite for dynamic url which has domain names -