2014-10-19 52 views
1

我与jQuery Mobile的问题,我得到在Safari以下错误:
Error: cannot call methods on page prior to initialization; attempted to call method 'bindRemove'
作为此下一个页面的结果不正确加载。jQuery Mobile的 - Safari浏览器错误:试图调用方法“bindRemove”

代码:

<body> 

<script> 
$("body").on("swiperight",function(){ 
    $.mobile.changePage('home.html', {transition: "slide", reverse: true}); 
});    
</script> 

<div data-role="page"> 
    <div id="home" class="footer"> 
    <div data-role="navbar"> 
     <ul> 
     <li><a href="home.html" data-icon="arrow-l" data-transition="slide" data direction="reverse">Previous</a></li> 
     </ul> 
    </div> 
    </div> 
</div> 

</body> 


我需要在Safari支持,因为我做的是iOS web应用,但目前完全在谷歌浏览器
jQuery Mobile的版本:1.4.4
谢谢

+0

请发布jQuery和JQM的版本。 – Omar 2014-10-19 13:47:08

+0

我正在使用JQuery Mobile 1.4.4 – Oliver 2014-10-19 13:49:06

+0

尝试将脚本移动到头部并确保所有标记都已正确关闭。 – Omar 2014-10-19 17:10:31

回答

0

在花费时间摆弄代码后,我找到了一个解决方案。我没有使用内联JQuery,而是使用我的两个滑动功能创建了一个文件。这里是我的代码:

$(document).on("swipeleft",function(){ 
    $.mobile.changePage('one.html', {transition: "slide", reverse: false}); 
}); 

$(document).on("swiperight",function(){ 
    $.mobile.changePage('home.html', {transition: "slide", reverse: true}); 
});