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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:30:57+00:00 2026-06-17T15:30:57+00:00

I need help with my vertical menu. This is what I have right now:

  • 0

I need help with my vertical menu. This is what I have right now:
http://jsfiddle.net/x4NbH/

What I want to do is if I have a <ul> open and click to open another section of the menu I want the open <ul> to close and the new one to open.
For example ‘item-1’ is open, I click ‘item-2’ and this closes ‘item-1’ and opens ‘item-2’.

HTML:

<div class="menu-item">
<h4 id="item-1"><a href="#">Item 1</a></h4>
<ul id="item-1">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</div>

<div class="menu-item">
<h4 id="item-2"><a href="#">Item 2</a></h4>
<ul id="item-2">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</div>

<div class="menu-item">
<h4 id="item-3"><a href="#">Item 3</a></h4>
<ul id="item-3">
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</div>

CSS:

.menu-item h4 {
    margin: 0px;
    padding: 0px;
}
.menu-item ul {
    margin: 0px;
    padding: 0px 5px;
    display: none;
}

JavaScript:

$( "h4#item-1" ).click(function() {
    $( "ul#item-1" ).toggle( "blind", 1000 );
});

$( "h4#item-2" ).click(function() {
    $( "ul#item-2" ).toggle( "blind", 1000 );
});

$( "h4#item-3" ).click(function() {
    $( "ul#item-3" ).toggle( "blind", 1000 );
});

How can I achieve this in a simple way?

  • 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-17T15:30:58+00:00Added an answer on June 17, 2026 at 3:30 pm

    IDs must be unique, you can use classes instead, try this:

    var $ul = $('ul');
    $( "h4" ).click(function() {
        $ul.hide("blind", 1000);
        $(this).next().show( "blind", 1000);
    });
    

    http://jsfiddle.net/zaZLj/

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

Sidebar

Related Questions

Right now I have this layout: <?xml version=1.0 encoding=utf-8?> <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent
http://jsfiddle.net/chakri/92tqF/ I need help with the above code. I am trying to disable the
I have a vertical accordion menu that opens on hover, stays open and closes
I need a css gunu out there to help me with this one. Right
Hi I need some help with this. The design calls for a vertical line
I need help. I have an app like Adium with vertical sliders. But my
I need some help with Google web toolkit to make a vertical menu with
I need help with making a vertical nav bar that slides to the right
i have created a jquery onhover vertical sliding menubar now i need to implement
Need help with a query that I wrote: I have three tables Company id

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.