Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7217995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T21:25:29+00:00 2026-05-28T21:25:29+00:00

I have asked the same in a previous topic but someone said that I

  • 0

I have asked the same in a previous topic but someone said that I should open another for this. So here it goes:

I’m animating a ribbon behind the navigation and the problem is that I want to keep the animated element in the previous place instead of going back to the starting position and coming back to the next element. I was able to achieve this, but without the use of hoverIntent. So now the ribbon will pick up every single movement on the navigation. How can I prevent this?

Correct me if I’m wrong but delay() and setTimeout() did not make sense at this point since they would fire up the last animation regardless of the stops. How can I prevent the mouseenter from firing up if the mouse is just passing by? Maybe an if clause on mouseover like if mouse is stable on the hovering block for more than 300 ms?

Note: I’m running a noConflict script, hence j = $.

function rbHover(){


    j("#nav li a")
        .on('mouseenter', function() {

        var l = j(this).parent().position().left;
        var w = j(this).parent().width();
        var rbw = Math.round(w/4);
        var rbh = Math.round(w/16);

            j("#ribbon").stop('ribbon', true, 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');
        })

        .on('mouseleave', function() {

        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).delay(300, 'ribbon').animate({
                "left" : l,
                "width" : w }, {
                    duration: 600,
                    easing: 'swing', 
                    queue: 'ribbon'
                 }).dequeue('ribbon');

            j(".rib-left").stop('rib-left', true, true).delay(300, 'rib-left').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).delay(300, 'rib-right').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');
        });
}

You can find my website at: http://www.egegorgulu.com

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T21:25:29+00:00Added an answer on May 28, 2026 at 9:25 pm

    Try this…

    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');
        }
    }
    

    I’ve just added an interval to the mouseenter event so it waits before firing – change hoverInterval to suit.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know many have asked the same question but I am still confused that
I realize that there was a similar question asked here , but this is
I know this has been asked ALOT on here, but I have been scouring
I have asked this before but I didn't get the question right so the
I have asked the same question before and I found this solution : if
I have asked this before but couldn't get it resolved, so asking again. I
I have asked aqbout timezones and date/time before but this is a more specific
I hate to ask the same question others have asked in Stackoverflow, but I
This is closely related to a previous question i asked. I have a many-to-many
I have asked a similar question before here , but after much thought, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.