Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am reading the docs that $.mobile.changePage has been deprecated.

But it doesn't say in favor of what, or what can I use instead.

Is there a new API documentation page for this?

I used to use $.mobile.changePage("index.html", {reloadPage:true}); but it seems that adding reloadPage:true the page breaks

Question&Answers:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
1.6k views
Welcome To Ask or Share your Answers For Others

1 Answer

As of jQuery Mobile 1.4, $.mobile.changePage() is deprecated and replaced with:

$(":mobile-pagecontainer").pagecontainer("change", "target", { options });

Shortened...

$.mobile.pageContainer.pagecontainer("change", "target", { options });

Even shorter...(1)

$("body").pagecontainer("change", "target", { options });

Note: target is #page_id or URL.

Demo


(1) <body> is pageContainer by default, unless $.mobile.pageContainer is modified on mobileinit.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...