Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Mobile after page is shown event

I'm new to jquery Mobile (I'm familiar with jquery though) and I cannot find an event that runs after the page is shown. I'm using jStorage to store some data and I want on load to check if there is any data and if there is to show something different in the page (like add elements to a list).

But the $(document).ready does not work if I change the page (meaning the hash changes).

EDIT: I've already tried the pageshow event

$('div').live('pageshow',function(event, ui){
  alert('TEST');
});

But it happens before the content is put in the HTML.

like image 337
Ciprian Mocanu Avatar asked May 25 '11 14:05

Ciprian Mocanu


1 Answers

From the jQuery Mobile documentation (which is always a good place to start):

pagebeforeshow

Triggered on the page being shown, before its transition begins.

pagebeforehide

Triggered on the page being hidden, before its transition begins.

pageshow

Triggered on the page being shown, after its transition completes.

pagehide

Triggered on the page being hidden, after its transition completes.

like image 167
DarthJDG Avatar answered Nov 15 '22 20:11

DarthJDG