문제

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.

도움이 되었습니까?

해결책

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%;
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top