Question

Right now I have a jQuery Accordion menu and when the [+] of a parent is clicked, the subcategories drop down. However, I'm trying to modify it so that when the entire parent category title is clicked it drops down as well, instead of just going to the main category page.

Here's a fiddle that I've got so far.

I was told I need something like this in it:

$('<menu title class>').on('click',function(event){
    event.preventDefault();
    event.stopPropagation();
    //pull the menu down 
 });

I have no idea where to place it, I just know that what I'm trying to accomplish needs done before line 64, in the first block of jQuery. The rest of the lower code was just other jQuery from my site the fiddle needed to not crash.

Was it helpful?

Solution

A CSS fix is probably simpler:

http://jsfiddle.net/isherwood/LtzZz/4/

.accordion span.opener {
    display: block;
    width: 100%;
    background-position: right 50%;
}

You'll want to wrap that in an appropriate media query so it only applies to the mobile menu.

Correction: Just use the .mobile class to filter it:

.mobile .accordion span.opener {
    display: block;
    width: 100%;
    background-position: right 50%;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top