Wednesday, 28 August 2013

With jQuery Mobile how can I detect every time a user is viewing a data-role="page"

With jQuery Mobile how can I detect every time a user is viewing a
data-role="page"

I need to fire a function eachtime a data-role page has been displayed.
the page being:
<div data-role="page" id="my-page">
I can get the alert to fire the first time the page is loaded by using:
$('#my-page').on('pageinit', function() {
alert('test');
});
But I want the alert everytime a user goes to #my-page.
Is it possible?

No comments:

Post a Comment