Ryan Grush
Ryan Grush

Reputation: 2128

Jquery accordion menu with image expander/collapser

I hacked some Jquery together to get my accordion menu more or less how I want it, except for this one issue. I'm trying to add an image in the corner to act as the expander/collapser so that it can do its thing and the tag before it can still do the navigation.

When I put it in using Jquery though, the gets included in with the tag.

$('#am_menu a').each(function() {
    if($(this).parent('li').children('ul').size() > 0) {
        $(this).append('<img src="http://goo.gl/S5j2J"/>');
    }
});

I know it has to be a fairly easy fix but I'm still pretty new to Jquery and am tired of looking at it.

http://jsfiddle.net/nosfan1019/ezDWg/1/

Upvotes: 0

Views: 593

Answers (1)

SpYk3HH
SpYk3HH

Reputation: 22580

Try this fiddle here and let me know if that helps any?

BUMP

Updated fiddle to better fit what you where trying to do and to include support for even deep levels ( see Main 3 inside Main 2 )

Upvotes: 1

Related Questions