Jquery mobile jQuery mobile在窗口状态下加载整个页面
我有下面的代码Jquery mobile jQuery mobile在窗口状态下加载整个页面,jquery-mobile,popstate,Jquery Mobile,Popstate,我有下面的代码 window.addEventListener('popstate', function(){ newHref = window.location.href; if(pushedState){ urlSplit = newHref.split('/'); pageURL = urlSplit[urlSplit.length - 1]; $('div').html('loading...'); $.aj
window.addEventListener('popstate', function(){
newHref = window.location.href;
if(pushedState){
urlSplit = newHref.split('/');
pageURL = urlSplit[urlSplit.length - 1];
$('div').html('loading...');
$.ajax({
type : 'POST',
url : pageURL,
success : function(data){
$('div').html(data);
}
})
}
})
这段代码工作正常,但是如果我将jQuery移动库添加到我的html文件中,它会导致popstate事件运行ajax,将整个页面加载到我的div中
我试过这样做
$.mobile.ajaxEnable = false;
但它不起作用。我的jQuery mobile版本是1.4.5从您向我们展示的内容来看,我认为您没有使用完整的jQuery mobile功能,因为您描述的是jQuery mobile的工作原理 我还假设您不需要所有jQuery移动函数 为什么不通过只选择您实际需要的功能来重建jQuery移动库: 例如,如果不选择init,这将禁用jQuery移动库的全局初始化。当然,您将能够手动触发页面标记增强