I am using the following script for a jquery accordion:
(function($) {
var allPanels = $('.accordion > dd').hide();
$('.accordion > dt > a').click(function() {
allPanels.slideUp();
$(this).parent().next().slideDown();
return false;
});
However, when I click on a title to close it, it closes and then imediately opens again. Script can be seen working here: http://www.one-event.org.uk/wordpress/#!/programme
So my question is, how can I make the active panel close when I click it again, rather than close and open straight away?
It immediately opens again as that is what your code is saying to do
replace those lines with