Using JQM 1.4.5.
I am trying to animate all collapsible content so they slide open and close when the header. I almost have it working with this:
$(document).on('collapsibleexpand', '.animateMe', function() {
$("[data-role='collapsible']").collapsible({
collapse: function( event, ui ) {
$(this).children().next().slideUp(150);
},
expand: function( event, ui ) {
$(this).children().next().hide();
$(this).children().next().slideDown(150);
}
});
});
The problem with this code is that I have to click at least one collapsible before the animation code kicks in.
I could do something like this:
$(document).on("pageinit", "#pageA", function(){
/* ABOVE CODE GOES HERE */
});
The problem with this solution is I have to write this code for each one of my pages. I tried the solution at JQuery Mobile Collapsable Slide Transition which my code is based on but the "pageinit" doesn't seem to work at all without giving it a page argument.
So how do I put this animation code into my js file so that it gets triggered for all collapsibles across all pages?