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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:13:37+00:00 2026-06-13T00:13:37+00:00

I have a page with Four Item buttons, when the user click on these

  • 0

I have a page with Four Item buttons, when the user click on these buttons the Content should slideDown.

If it is already a visible content this content must be slided up and then the right content should be slided Down.

Everything works fine, but if the user click fast between the Item Buttons the slides get jammed and start to appear on top of the others.

Here is an example.:
http://jsfiddle.net/7t6Eh/42/

If the user click “slow” between the Items, everything works ok.

  • To re-create the error Click Fast Between the Item Buttons.

I’ve already tried to use ‘.is(“: visible”)’ but got the same results.

Can anyone help me out?

CODE

var active = 0;

    $("#item1").click(function(){

        if (active == 0){

            $("#ContentList1").stop().slideToggle(function() {
                active = 1;
            });

        } else {

            if (active != 1){
                $("#ContentList" + active).stop().slideToggle(function() {

                    $("#ContentList1").stop().slideToggle(function() {
                        active = 1;
                    });

                });
            }
        }
    });

    $("#item2").click(function(){

        if (active == 0){

            $("#ContentList2").stop().slideToggle(function() {
                active = 2;
            });

        } else {

            if (active != 2){
                $("#ContentList" + active).stop().slideToggle(function() {

                    $("#ContentList2").stop().slideToggle(function() {
                        active = 2;
                    });

                });
            }
        }
    });

    $("#item3").click(function(){

        if (active == 0){

            $("#ContentList3").stop().slideToggle(function() {
                active = 3;
            });

        } else {

            if (active != 3){
                $("#ContentList" + active).stop().slideToggle(function() {

                    $("#ContentList3").stop().slideToggle(function() {
                        active = 3;
                    });

                });
            }
        }
    });    

    $("#item4").click(function(){

        if (active == 0){

            $("#ContentList4").stop().slideToggle(function() {
                active = 4;
            });

        } else {

            if (active != 4){
                $("#ContentList" + active).stop().slideToggle(function() {

                    $("#ContentList4").stop().slideToggle(function() {
                        active = 4;
                    });

                });
            }
        }
    });
  • 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-06-13T00:13:38+00:00Added an answer on June 13, 2026 at 12:13 am

    I usuallly do this kind of things taking advantage of siblings() to select adjacent divs and stop them, rather than using an “active” var to store the active div:

    $(document).ready(function(){
        $("#item1").click(function(){
            $('#' + $(this).attr('for'))
                .slideDown().siblings('div').stop().slideUp()
        });
        $("#item2").click(function(){
            $('#' + $(this).attr('for'))
                .slideDown().siblings('div').stop().slideUp()
        });
        $("#item3").click(function(){
            $('#' + $(this).attr('for'))
                .slideDown().siblings('div').stop().slideUp()
        });
        $("#item4").click(function(){
            $('#' + $(this).attr('for'))
                .slideDown().siblings('div').stop().slideUp()
        });
    });
    

    you can use the “for” attribute (or any other) to specify the div that the link is referring. For example:

    <div id="item1" for="ContentList1" style="float: left; width: 50px; cursor: pointer;">Item1</div>
    

    ​
    An example working fiddle: http://jsfiddle.net/7t6Eh/46/

    ADDED: If you want to do the close animation before the open animation, you can use jQuery deferred like this:

    $("#item1").click(function(){
        content = $('#' + $(this).attr('for'));
        $.when(content.siblings('div').stop().slideUp())
            .then(function () { content.slideDown() });
    });
    

    of course apply to all 4 click events. Example: http://jsfiddle.net/7t6Eh/52/

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

Sidebar

Related Questions

I have a page where user is provided with four search fields. I am
I have on master page four user controls which are binded to shared presenter.
Let's say I have four tables: PAGE , USER , TAG , and PAGE-TAG
I have a page that needs to combine data from four different webrequests into
Hi I have a page for which I have four different style sheets like
I have a xaml navigation page with 5 listboxes (Silverlight 3). Four of the
I have a <odc:tabbedPanel/> component. Inside this I have a page in the <odc:bfPanel/>
Is it possible to switch HTML on click? I have an index page with
I have four images on a page that on hover, needs to replace the
I am setting up a page with jQuery's Cycle plugin and have four divs

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.