Javascript function to animate collapsible set only works on first page?
I have been struggling with the below function, which I have tried to place in page load and also show event on every page that has a collapsible set. It work perfetly on the first loaded page with a collapsible, but on subsequent pages it does not work (on subsequent pages the collabsible will not expand).
$(document).on('expand', '.ui-collapsible', function(event) {
var contentDiv = $(this).children('.ui-collapsible-content');
contentDiv.hide();
contentDiv.slideDown(300);
event.preventDefault();
event.stopPropagation(); // don't bubble up
});
$(document).on('collapse', '.ui-collapsible', function(event) {
var contentDiv = $(this).children('.ui-collapsible-content');
contentDiv.slideUp(300);
event.preventDefault();
event.stopPropagation(); // don't bubble up
});