我遇到一个关于JQM函数$ .mobile.changePage()的新奇怪错误。我在我的应用程序中有几个列表视图但是当我将最新的一个列表添加到应用程序的主页时,我发现此功能导致所有其他内部链接停止工作并且该功能从未实际更改页面。它似乎冻结了。
$(document).on('pageinit', '#home', function(){
$('#top-gender-list').on('click', 'li', function(data){
currentBar.id = $(this).attr('id');
currentBar.name = $(this).text();
$.mobile.changePage("#bar"); ///freezes here FYI data is being returned successfully
});
});
//这是一个HAS在过去添加上面之前工作的函数。现在它不再有用了。它正在做与上面相同的事情。 (停止所有内部链接工作,永不更改页面)
$(document).on('pageinit', '#bars', function(){
$('#bars').on('click', 'li', function(data){
currentBar.id = $(this).attr('id');
currentBar.name = $(this).text();
$.mobile.changePage("#bar");
});
});
我无法弄清楚这是由于语法错误还是带有phonegap的故障。
仅供参考我将此代码上传到网络服务器时,不会出现这些问题。所有listitem链接都可以正常运行。