Initialize JS Scripts on jQueryMobile Page
I am working on a single-page app using jQueryMobile 1.0 Beta 2 and testing on iOS 4.3.5 Mobile Safari.
As we can see here: http://jquerymobile.com/test/docs/api/events.html
The jquery mobile api is very specific on the new way to initialize scripts with the ajax calls. I am using the pageCreate() event from the jquery mobile api to initialize my scripts:
$('.ui-page').live('pagecreate',function(event){
//my js init codes
});
But somehow, it开发者_StackOverflow is not so effective and I am having trouble on one of my key views which doesn't initialize.
Any help is appreciated.
Thank you.
Try using the pageshow event:
$('.ui-page').live('pageshow', function(event) {
// js init codes
});
This is working for me in my app. Hope it works for you.
精彩评论