user2512710
user2512710

Reputation: 42

Document.ready for the target page not getting invoked using jquery mobile transistion

I'm using jquery mobile 1.3.1 to develop a iphone mobile app, and while there is a page transition from A to B , page B on load function ie $(document).ready is not getting invoked

while if i use window.location.href to navigate from A to B, the function is getting called without any issues.

I have to use the page transition for my application and any suggestion on how to resolve this issue would be greatly appreciated

Upvotes: 1

Views: 521

Answers (2)

Nagama Inamdar
Nagama Inamdar

Reputation: 2857

$('#page_id').on('pageshow', function(event) { 

//Your script logic

});

In jquery mobile its not suggested to use document.ready.since it loads only page divs while executing.(<div data-role="page" id="page_id">) here we can use page.on function.

Note:jquery mobile does not work smoothly with page transitions even if we are using latest release of jquery mobile.For time being we can turn them off (page-transition="none") up till the release of jquery mobile next version.If transitions are working properly with the script being executed then I won't suggest to turn them off.

Upvotes: 2

omma2289
omma2289

Reputation: 54619

Take a look at the jQuery Mobile FAQ:

http://view.jquerymobile.com/1.3.1/dist/demos/faq/dom-ready-not-working.html

Upvotes: 1

Related Questions