in this project im using jquery and phonegap
i have a link that if clicked , changes the page:
$('#statsButtonmain').on('click', function() {
$.mobile.changePage("stats.html", { transition: "slideup"}, true, true);
});
this works fine, but i would like to run a function (playMusic()) when the transition is done, something like this:
$('#statsButtonmain').on('click', function() {
$.mobile.changePage("stats.html", { transition: "slideup"}, true, true);
playMusic();
});
i found out that there is a pageshow event that gets triggered on the page being shown, after its transition completes, but im not sure how to use it
this doesn’t seem to work, any ideas?
Thanks
I’ve not done a lot a jQuery mobile development so this might not be the most efficient solution. As you said, the
pageshowevent is what you need to use. Here are the 2 HTML files I ran locally in which I see the alert after thestats.htmlpage transition is completed. The.live()is bound to the#statselement’s pagepageshowevent.HTML
(saved as index.html)
(saved as stats.html)