开发者

jQuery Mobile after page is shown event

开发者 https://www.devze.com 2023-03-08 03:15 出处:网络
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 i

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 bef开发者_StackOverflowore the content is put in the HTML.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消