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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:54:55+00:00 2026-05-23T23:54:55+00:00

I have a construct like this……. <div id=right_top_block class=drop_head> <div id=right_top_block_head class=dropper block_head rounded-corner>

  • 0

I have a construct like this…….

<div id="right_top_block" class="drop_head">
    <div id="right_top_block_head" class="dropper block_head rounded-corner">
        Friends
    </div>
    <div class="box_container">
        <div id="box_list" class="drop_list">
            <ul id="right_top_ul">    
            </ul>
        </div>
    </div>
</div>

I removed the inner contents as it is too lengthy… and i have a jquery like this…

$(document).ready(function() {
    $('.drop_head').each(function(i, e) {
        $('.dropper', e).click(function() {
            $('.drop_list', e).slideToggle(1500);
        });
    });

    $('.dropper').click(function(e) {
        $(e.target).parent().removeClass('leaf_class');
        if ($(e.target).parent().height() < 300) $(e.target).parent().addClass('leaf_class');
    });
});

Now what happens is, each time the dropper is clicked, a leaf class is added to the right_top_block and then a slideDown(as part of slideToggle) on the correspoding drop_list is done( I have many such)…. Now if it is clicked again the leaf class is removed from the right_top_block and then a slideUP(as part of slideToggle) on the corresponding drop_list is performed. But what i really want is, when a slideUp is performed, i want the slideToggle to complete and then i want the leaf_class to be removed. How do i change the order of the event execution? I guess due to the delay 1500 i am specifying in the toggle is the cause for this. While don’t want to loose the slow transition that it gives, i want that to be completed and then the leaf class to be removed. How do i do this?

  • 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-23T23:54:55+00:00Added an answer on May 23, 2026 at 11:54 pm

    First, two remarks about the code in your question:

    • The code that runs on click is split into two event handlers: one responsible for the slide animation and the other for the class change. That’s quite confusing and actually makes the problem more complex. It would be easier if these two handlers were merged into one, or if one handler was performing the whole slideDown() operation sequence and the other the whole slideUp() sequence.

    • You’re using e.target with an element that doesn’t seem to contain any descendant from where a click event would bubble up. That’s perfectly valid in itself, but using this instead would be shorter and make your intent clearer.

    Now, let’s look at your requirements. It looks like you want leaf_class to be added before the slideDown() animation starts, but only removed after the slideUp() animation completes.

    You can achieve that in a simpler way with a pair of handlers bound to the toggle event, and explicit calls to slideDown() and slideUp() instead of slideToggle().

    $('.dropper').toggle(function() {
        var $dropHead = $(this).parent();
        $dropHead.addClass("leaf_class");
        $(".drop_list", $dropHead).slideDown(1500);
    }, function() {
        var $dropHead = $(this).parent();
        $(".drop_list", $dropHead).slideUp(1500, function() {
            $dropHead.removeClass("leaf_class");
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an enum construct like this: public enum EnumDisplayStatus { None = 1,
I have Java classes like this: public class Config { public Config1 getConfigOpt1(); public
I have a problem.... Lest say I have a class like this one: public
Ought I to unit test constructors? Say I have a constructor like this: IMapinfoWrapper
I have a constructor like as follows: public Agent(){ this.name = John; this.id =
I have a polygon soup of triangles that I would like to construct a
I've seen somewhere a urls.py construct like this: from project.f import SomeClass urlpatterns =
I want to do something like this: class SomeClass<T> { SomeClass() { bool IsInterface
I have a math problem which is written like this: x^1+x^2+x^3+...+x^n Are there any
So I have noticed that things (for lack of a better word) like this

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.