Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Try this...</p> <pre><code>function rbHover(){ var timeoutID = 0; var hoverInterval = 300; j("#nav li a") .on('mouseenter', function() { clearTimeout(timeoutID); timeoutID = setTimeout(mouseEnter, hoverInterval, this); }) .on('mouseleave', function() { clearTimeout(timeoutID); timeoutID = setTimeout(mouseLeave, hoverInterval); }); function mouseEnter(el) { var l = j(el).parent().position().left; var w = j(el).parent().width(); var rbw = Math.round(w/4); var rbh = Math.round(w/16); j("#ribbon").animate({ "left" : l, "width" : w }, { duration: 600, easing: 'swing', queue: 'ribbon' }).dequeue('ribbon'); j(".rib-left").stop().animate({ "border-right-width": rbw, "border-left-width": rbw, "border-top-width": rbh, "border-bottom-width": rbh, "bottom": "-" + (2*rbh) + "px"}, { duration:600, easing: 'linear', queue: 'rib-left' }).dequeue('rib-left'); j(".rib-right").stop().animate({ "border-right-width": rbw, "border-left-width": rbw, "border-top-width": rbh, "border-bottom-width": rbh, "bottom": "-" + (2*rbh) + "px"}, { duration:600, easing: 'linear', queue: 'rib-right' }).dequeue('rib-right'); } function mouseLeave() { var l = j(".active").parent().position().left; var w = j(".active").parent().width(); var rbw = Math.round(w/4); var rbh = Math.round(w/16); j("#ribbon").stop('ribbon', true).animate({ "left" : l, "width" : w }, { duration: 600, easing: 'swing', queue: 'ribbon' }).dequeue('ribbon'); j(".rib-left").stop('rib-left', true, true).animate({ "border-right-width": rbw, "border-left-width": rbw, "border-top-width": rbh, "border-bottom-width": rbh, "bottom": "-" + (2*rbh) + "px"}, { duration:600, easing: 'linear', queue: 'rib-left' }).dequeue('rib-left'); j(".rib-right").stop('rib-right', true, true).animate({ "border-right-width": rbw, "border-left-width": rbw, "border-top-width": rbh, "border-bottom-width": rbh, "bottom": "-" + (2*rbh) + "px"}, { duration:600, easing: 'linear', queue: 'rib-right' }).dequeue('rib-right'); } } </code></pre> <p>I've just added an interval to the mouseenter event so it waits before firing - change hoverInterval to suit.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload