Jquery $.mobile.changePage();don';在我的下一页不会触发吗?
im使用Jquery $.mobile.changePage();don';在我的下一页不会触发吗?,jquery,jquery-mobile,Jquery,Jquery Mobile,im使用$.mobile.changePage()转到页面。奇怪的是,在我的索引页中,它可以工作,但如果我单击下一页并触发swipedown themobile.change它现在不工作。。我知道我的swipedown事件不是这里的问题,因为我试图注释mobile.changepage并插入一个警报函数,它被触发 过程: 在我的索引页中$.mobile.changePage事件工作 $(document).delegate('.front-page-down','swipedown', func
$.mobile.changePage()代码>转到页面。奇怪的是,在我的索引页中,它可以工作,但如果我单击下一页并触发swipedown themobile.change
它现在不工作。。我知道我的swipedown事件不是这里的问题,因为我试图注释mobile.changepage
并插入一个警报函数,它被触发
过程:
在我的索引页中<代码>$.mobile.changePage
事件工作
$(document).delegate('.front-page-down','swipedown', function (event) {
$.mobile.changePage('#notification', { transition: "slidedown"});
});
转到下一页,例如第2页,并尝试触发我的刷卡事件,mobile.changePage不起作用
$(document).delegate('.sns-down','swipedown', function (event) {
//$.mobile.changePage('#featured', { transition: "slidedown"}); // this don't work in my next page
alert("BOOM SNS");
});
有人知道为什么会这样吗?函数更改页包含在委托函数中。我没有使用任何document.ready()函数
仅供参考。要使mobile.changePage在我的页面2中工作,我必须手动刷新页面。嗯
帮助任何人。使用jQuery Mobile,我会这样做
$('.sns-down').each( function(){
$(this).live('swipedown', function (event) {
//$.mobile.changePage('#featured', { transition: "slidedown"}); // this don't work in my next page
alert("BOOM SNS");
});
});
如果那不起作用。。您可以尝试使用以下命令重新加载该页面的jquery mobile:
$.mobile.activePage.page("destroy").page();
在绑定swipedown事件之前。请查看
在“头部脚本和样式”部分,您可以找到解决方案。
把你的脚本放到body标签中,然后你就不需要刷新你的页面了!
我希望这对你解决这个问题有用