There you go: http://mooshell.net/VhXb3/9

You need to add the event parameter to the click function and stop the event from bubbling up the DOM. :)

But, beware, you also break a UI paradigm by not opening the accordion upon click of the link. Is suggest you add little arrow icon (pointing right) right where the plus icon now is and that should be your link with the href.

This way you don't break user expectation *and* have the link right there. The code then shouldn't change, just the click function applied to the icon.

Really cool accordion by the way. Keep at it! :)

Cheers, Daniel



On 2009-10-24, at 24/October, 9:07 PM, cbolson wrote:


I am using a slightly adapted version of a mootools nested accordion
from here:
http://blog.medianotions.de/en/articles/2008/mootools-nested-accordion

I have it working as needed as regards opening the nested elements
(can't get them to close yet but that is a different matter)
However I have a problem which I can't seem to solve.
The togglers can and do contain links that will link to real pages (I
am using the accordion for a menu).  The problem is that when you
click on them the accordion starts to open until the page changes
causing undesirable flicker (depending on the time it takes the page
to change).

So, what I need to do is stop the accordion from being toggled when
these links are clicked on.

Is there any way that I can stop elements (hrefs) contained within the
toggler element from intiating it when they are clicked on?

I have set up a slimmed down demo of me code here (the full code also
detects the current page and opens the menu at the correct position):
http://mooshell.net/VhXb3/7

You will see that I have added a check on all the "hrefs" within the
accordion but at the moment it does nothing more than show a message -
this is the action that I need to modify to stop the toggling.

Any help, pointers etc would be greatly apreciated.
Of course if anyone has any alternative methods for achieving my
nested dropdown menu I would also be interested ;)

Thanks in advance

Chris

Reply via email to