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 6673375
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:37:13+00:00 2026-05-26T03:37:13+00:00

I am having problems with these tabs I wrote. They seem to work fine

  • 0

I am having problems with these tabs I wrote. They seem to work fine but if mouse over them fast enough the elements begin to stack. I don’t understand why this is happening because the fade in of the next element is only supposed to happen when the first element has fired the end of its fadeout? The tabs can be found here:

http://artmodish.com/ithos/Content/us.php

$(document).ready(function(){
$('#info-tabs .inner:first').fadeIn(200);
$('#info-tabs li:first').addClass('current-tab');

$('#info-tabs li').stop().mouseover(function(){
    var current = $(this);
    $('#info-tabs li').each(function(){
        $(this).removeClass('current-tab');
    });
    current.addClass('current-tab');

    $('#info-tabs .inner').each(function (){
        var thisInner = $(this);
        if(thisInner.attr('id')==current.attr('id')) {
            $('#info-tabs div div').filter(':visible').fadeOut(500,function(){
                thisInner.fadeIn(200);
            });
        }
    });
});
});
  • 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-26T03:37:14+00:00Added an answer on May 26, 2026 at 3:37 am

    The problem is the delay between setting current and using it. If you move the mouse over another tab within the 500ms animation, the handler will be called twice (with different values for current) and will show the contents for two tabs.

    An easy way round this is to make current into a global variable, so that all of the animations, when they complete part 1, will show the same tab (the last one you moused over).

    $(function ()
    {
        var current;
    
        $('#info-tabs .inner:first').fadeIn(200);
        $('#info-tabs li:first').addClass('current-tab');
    
        $('#info-tabs li').mouseover(function ()
        {
            current = $(this);
            $("#info-tabs li").removeClass("current-tab");
            current.addClass("current-tab");
            $("#info-tabs .inner:visible").fadeOut(500, function () { $("#info-tabs .inner#" + current.attr("id")).fadeIn(200); });
        });
    });
    

    This isn’t ideal, though, as you end up with an unwanted ‘global’ variable and can build up a large animation queue (I got up to 9 with some frantic mouse movement).

    I had a go at getting round this by clearing the queue at the start of the mouseover handler (and setting it to complete the animation). This kinda works (the end result’s OK), but it does give some unfortunate flashes of content on the way. Hm. (I had to move the fadeIn out of the fadeOut so I could guarantee it would be completed by the stop.)

    $(function ()
    {
    
        $('#info-tabs .inner:first').fadeIn(200);
        $('#info-tabs li:first').addClass('current-tab');
    
        $('#info-tabs li').mouseover(function ()
        {
            var current =  $(this);
    
            $("#info-tabs *").stop(true, true);    
            $("#info-tabs li").removeClass("current-tab");
            current.addClass("current-tab");
            $("#info-tabs .inner:visible").fadeOut(500);
            $("#info-tabs .inner#" + current.attr("id")).delay(500).fadeIn(200);
        });
    });
    

    (Also removed the each calls as they weren’t really necessary.)

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

Sidebar

Related Questions

hey there, Im having problems displaying my results in this program but the program
After having some problems with these two linker errors on SO , I have
I am having some problems with a few queries using Linq to NHibernate. These
I am having problems with VS2008 moving the windows around and losing tabs when
I'm new to MATLAB and I'm having problems plotting these two equations. I'm trying
I am having some problems parsing this piece of XML using SimpleXML. There is
Having problems with a small awk script, Im trying to choose the newest of
Having problems iterating. Problem has to do with const correctness, I think. I assume
Im having problems displaying records to my view when passing viewdata to a user
I am having trouble reading a csv file, delimited by tabs, in python. I

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.