jQuery   发布时间:2022-04-19  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Jquery手机:在加载前重定向到另一个页面大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我使用 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

希望它有帮助:)

大佬总结

以上是大佬教程为你收集整理的Jquery手机:在加载前重定向到另一个页面全部内容,希望文章能够帮你解决Jquery手机:在加载前重定向到另一个页面所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: