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

  • Home
  • SEARCH
  • 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 6707345
In Process

The Archive Base Latest Questions

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

Basicllay i have a div with a class called .li-level-1, and inside that i

  • 0

Basicllay i have a div with a class called .li-level-1, and inside that i have differnt ul’s with lists. i Have it set up so when you click on a li-level-1 div displays the ul’s and li’s inside that div by animating a drop down and when you click on the next one it closes the one previously opened and slidesDown the next one.

the only thing is the a links that are inside the div’s seem to trigger the slideUp/Down on level-1 and animation as well.

any Suggestions?

$('.sitemap_page .li-level-1').each(function(){
    $(this).find('ul.ul-level-2').hide();
    $(this).click(function(){
        var this_list = $(this);
        this_list.parent().find('.open').each(function(){
            $(this).slideUp(function(){
                this_list.find('ul.ul-level-2').addClass("open").slideDown();
            }).removeClass('open');
        });
        if(this_list.find('ul.ul-level-2.open').length == 0) {
            this_list.find('ul.ul-level-2').addClass("open").slideDown();
        }
    });
});
  • 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-26T07:37:41+00:00Added an answer on May 26, 2026 at 7:37 am

    That’s because of event bubbling: the click event raised on the <a> elements bubble up to their containing <div> and cause your event handler to execute.

    One way to work around that problem would be to use event.target to determine the event’s origin, and only perform the sliding animations if the event did not originate on a link:

    $(this).click(function(event) {
        if (!$(event.target).is("a")) {
            var this_list = $(this);
            this_list.parent().find('.open').each(function() {
                $(this).slideUp(function() {
                    this_list.find('ul.ul-level-2').addClass("open").slideDown();
                }).removeClass('open');
            });
            if (this_list.find('ul.ul-level-2.open').length == 0) {
                this_list.find('ul.ul-level-2').addClass("open").slideDown();
            }
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using galleria jquery plugin. I have a div with class carousel, This
I have a coming_soon_controller that displays a form for users to subscribe to an
ok so basically I have this: <div id=tabs> <div id=unique_id class=tab_link onclick=changeTab(this);> <div id=tab_link_image
I have a page with many elements that have the same class attached to
I have the following DOM structure: <div class=city> <div class=a>Delete</div> <div class=b>Selected</div> <div class=c>Delete</div>
Basically, when there are search results the body gets a class called .have-results .
I've been battling to get this right...basically I have the following HTML setup: <div
I basically have a server set up and I'm accepting new clients(UNIX) and i'm
I basically have 7 select statements that I need to have the results output
I basically have to do a update of a record. I have a set

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.