I\'m working on a page using jQuery\'s accordion UI element. I modeled my HTML on that example, except that inside the elements, I have some unordere
here is a really simple solution
http://www.designerstalk.com/forums/help-me/41297-jquery-accordion-embedding-links-help-needed.html
Try adding an inline onlick that prevents event bubbling:
...
<a href='#' onclick="event.stopPropagation()" class="accordion-label">A Group of Links</a>
...
Or a domready event like so:
$(".toggle-title a").click(function(event){ event.stopPropagation()})
However the latter didn't work for me even though code wise it makes sense, jQuery executes the click! Anyone that can explain that to me feel free, I come from MooTools and Google Closure background which has addEvent functions.
I had this exact same problem and could not find an answer anywhere. In fact, a couple sources said it just couldn't be done.
Upon further playing, I did find a working solution. May not be great, but it works like a charm.
First, just make sure the links you want to be clickable, and immune to the accordion controls, is easily identifiable. I had a class on mine.
$('.stats a').click(function(){
expander.accordion('disable');
window.open($(this).attr('href'));
setTimeout ( function() {
expander.accordion('enable');
}, 250 );
});
Essentially, this listens for when a link inside the accordion header is clicked. When it is, the accordion is temporarily disabled, keeping it from firing as normal. The link is then opened, in this case, in a new window but you could use document.location as well
If we re-enabled the accordion immediately, it will still fire and toggle the accordion. I found that a super-short timeout provides enough delay.
Hope this helps someone!
AlwaysOpen should be true.
As my answer to your other question says:
navigation: true
Should be set in your option list.
Here is a possible alternative script for anyone still experiencing this issue: http://twostepmedia.co.uk/notes/development/jquery-accordion/