我使用
jquery mobile 1.0
我想从first.html重定向到otherPage.html,而不显示first.html的内容
- $("#pageId").live("pagebeforecreate",function(event) {
- window.location.href = "otherPage.html";
- });
-i尝试了几乎每一个事件,但不成功. first.html显示了一会儿.
然后,我尝试使用’pagebeforeload’事件,但它没有触发
- $( document ).bind( "pagebeforeload",function( e,data ){
- console.log("pagebeforeload starting"); // NO LOGGING HAPPENING
- window.location.href = "otherPage.html";
- e.preventDefault();
- data.deferred.resolve( data.absUrl,data.options,response.page);
- });
- $( document ).bind( "pageload",data ){
- console.log("Page successfully loaded into DOM..."); // NO LOGGING HAPPENING
- });
– 这个事件不太清楚没有找到可行的例子.
– 任何人都可以帮忙!
解决方法
尝试这一个
- $("#firstPageId").live("pagecreate",function(){
- $.mobile.changePage("otherPage.html");
- });
另外,您可以使用loadPage
希望它有帮助:)