I am currently implemented a jquery based accordion on a navigation section, but some parts of the navigation don't need to be part of the accordion (if there are no categories etc) i am just wondering if it is possible to disable parts of the accordion or not ?
i get the feeling this could be impossible but this site has surprised me before :)
Thanks very much.
Previous trick does not work because of the binding order of events, but the following works:
// Add the class ui-state-disabled to the headers that you want disabled
$( ".whatyouwant" ).addClass("ui-state-disabled");
// Now the hack to implement the disabling functionality
var accordion = $( "#accordion" ).data("accordion");
accordion._std_clickHandler = accordion._clickHandler;
accordion._clickHandler = function( event, target ) {
var clicked = $( event.currentTarget || target );
if (! clicked.hasClass("ui-state-disabled")) {
this._std_clickHandler(event, target);
}
};
Whenever you want to activate a tab, do:
// Remove the class ui-state-disabled to the headers that you want to enable
$( ".whatyouwant" ).removeClass("ui-state-disabled");
That's it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With