JQuery UI: Accordion callbacks
Posted
by user177215
on Stack Overflow
See other posts from Stack Overflow
or by user177215
Published on 2010-03-24T13:54:14Z
Indexed on
2010/03/24
14:43 UTC
Read the original article
Hit count: 397
I need my javascript to only do the callback when I OPEN a section on the accordion, as of right now it does a callback when I open OR close a section because I'm only using a click function. Is there a way I can modify my existing click function to only run when the given section is activated?
My current click function:
$("a#mimetypes").click(function() {
$("span#mimetypesthrobber").loading(true, { max: 1500 })
$.getJSON("../mimetypes", function(data) {
//callback
});
});
Thanks!
EDIT:
I already tried this with another part of the accordion and it wasn't working properly:
$('.ui-accordion').bind('accordionchange', function(event, ui) {
if (ui.newHeader == "Encoders") {
EncodersGet();
}
});
© Stack Overflow or respective owner