开发者

Initialize JS Scripts on jQueryMobile Page

开发者 https://www.devze.com 2023-03-29 12:35 出处:网络
I am working on a single-page app using jQueryMobile 1.0 Beta 2 and testing on iOS 4.3.5 Mobile Safari.

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.

0

精彩评论

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

关注公众号