我正在用这种方法更改页面
$.mobile.changePage("Preview.html", {
transition : "slide",
role : "page",
changeHash:true
});
这就是我的预览页面的样子
<div data-role="page" data-name="preview" class="prew">
<div data-role="content">
//content
</div>
</div>
现在,当我触摸屏幕时,我必须返回上一页。
所以我创建了这个函数
$('.prew').live('tap', function() {
alert('clicked');
history.go(-1);//<--this works in simulator not in device.
//window.history.back() ;//<--this also works in simulator not on device.
//navigator.app.backHistory();<--this works fine on android not on iOS.
});
编辑:我使用了一个名为 photoswipe 的插件,它导致了这个问题。history.go(-1),history.back() 或 data-rel="back" 在其他页面上工作正常。
photoswipe 阻止返回上一页。