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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:12:39+00:00 2026-05-30T10:12:39+00:00

I have the following code: // Hide all divs that are not the default

  • 0

I have the following code:

// Hide all divs that are not the default
                $('div.apps-description > div').not('.default').hide();

                // When an icon is hovered
                $('ul.apps-links li a').hover(function() {

                    var liClass = $(this).parents('li').attr('class');

                    $('div.apps-description > div:visible').fadeOut('fast', function() {
                        $('div.' + liClass).fadeIn('fast');
                    });

                },function()
                {
                    $('div.apps-description > div:visible').fadeOut('fast', function() {
                        $('div.apps-description > div.default').fadeIn('fast');
                    });
                });

And the markup is for example:

<ul class="apps-links">
    <li class="app-one"><a href="./">Test</a></li>
    <li class="app-two"><a href="./">Test</a></li>
    <li class="app-three"><a href="./">Test</a></li>
</ul>

<div class="apps-description">
    <div class="default">Default Content</div>
    <div class="app-one">Default Content</div>
    <div class="app-two">Default Content</div>
    <div class="app-three">Default Content</div>
</div>

The idea is that the default div is show on page load, and then when you hover an item it fades out the default and the linked div based on its matching class. This all works fine except if I hover over to another link before it’s properly faded out again it will cause BOTH the default and the new div to show!

Any ideas how to fix this? I tried using .stop() but that just causes animations to breaks as they stop mid fade and append crappy opacity values.

EDIT: Also noticed that if I hover through all the link it will cause all the divs to show up, but they will then auto-fix themselves. So it’s clearly an issue with the fadein and outs happening in bad sequence with each other.

  • 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-30T10:12:40+00:00Added an answer on May 30, 2026 at 10:12 am

    Try this:

    var target_class = 'default';
    $('div.apps-description > div').not('.default').hide();
    
    // When an icon is hovered
    $('ul.apps-links li a').hover(function() {
    
            target_class = $(this).parents('li').attr('class');
    
            $('div.apps-description > div:visible').fadeOut('fast', function() {
                $('div.' + target_class).fadeIn('fast');
            });
    
    }, function() {
        target_class = 'default';
        $('div.apps-description > div:visible').fadeOut('fast', function() {
            $('div.' + target_class).fadeIn('fast');
        });
    });
    

    Using a global “target_class” will avoid several items showing as just one is the target.

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

Sidebar

Related Questions

I have the following HTML code: <fieldset> <legend><span>Contact Details</span> <span class=edit1>Edit</span><span class=hide1>Hide</span></legend> <div> <!--content-->
I have come across the following code that looks at divs contained inside divWiz
I have the following code: $('.breadcrumb:contains(,)').hide(); It does as expected and hides the entire
I have the following code: $(document).ready(function(){ $(.yearInner).hide(); $(.year, this).hover( function () { $(.yearInner, this).slideToggle();
i have following code to show div on page <div id=all_users> <div id=user11 userid=11
I have the following html code: <div class=Radios> <span class=radio> <input type=radio value=1> yes
I have the following code: $(a.sticky-link).click(function (e) { e.preventDefault(); $(div.stickies-box).slideToggle('slow'); $(a.sticky-link).toggleClass(selected); }); $(div.stickies-box).mouseup(function ()
I have the following Javascript code which controls an accordion type set of divs.
I have the following code to show a progress ajax icon and then run
http://jsfiddle.net/yrM3H/2/ I have the following code: jQuery(document).ready(function() { jQuery(.toggle).next(.hidden).hide(); jQuery(.toggle).click(function() { $('.active').toggleClass('active').next('.hidden').slideToggle(300); $(this).toggleClass('active').next().slideToggle(fast); });

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.