Roland
Roland

Reputation: 9731

Toggle going wrong?

I have made some menu with a slide down submenu. It should work fine but for some reason it doesn't work. I mean if you look at this fiddle: http://jsfiddle.net/yJdFu/2/ , you'll see that the big menus don't slide down when the submenu toogles.

Can you tell me why isn't it working ?

Upvotes: 1

Views: 63

Answers (2)

Scott
Scott

Reputation: 21888

It is actually working. The problem is you have a specified height to the list items. So the submenu is appearing below the existing items.

Remove the height from the list items. Updated Fiddle

You weren't missing any closing tags. The html is correct. Error was in CSS. Also, I altered the jquery a bit. not sure why you were using .find() when the item can be called by it's class, and I specified which toggle to use.

This fiddle uses jquery which specifies the toggle only occurs on the "dashboard" link. Otherwise the sub navigation closes when one of its links is clicked.

Upvotes: 1

njr101
njr101

Reputation: 9629

You are missing a closing </li> tag.

<li class="dashboard"><a href="#">
  <img src="assets/gfx/dashboard.png" alt="Dashboard">
  <span>Dashboard</span></a>
</li>

see here http://jsfiddle.net/yJdFu/4/

As Roland said above, you may also want to look at the built-in JQuery UI Accordion before rolling your own solution.

Upvotes: 0

Related Questions