jquerymobile使用技巧
1)ajax開關(guān)(默認(rèn)jquery以ajax方式加載頁面)
$.mobile.ajaxEnabled = false;
?
2)不編譯指定標(biāo)簽
$.mobile.page.prototype.options.keepNative="input";
?
3)開啟dom緩存
$.mobile.page.prototype.options.domCache = true;
?
4)多個(gè)頁面分開寫于不同的html里,在首頁用loadPage方法一次性加載其他頁面(全部)
$(document).ready(function(){
$.mobile.loadPage('aaa.html');
$.mobile.loadPage('bbb.html');
$.mobile.loadPage('ccc.html');
$.mobile.loadPage('ddd.html');
});
?
5)當(dāng)前頁面id
$(document).on("pageshow",function(event,data){
currentPage = data.toPage[0].id;
});
?
6)當(dāng)前激活頁面
$($.mobile.activePage)
?
7)手動(dòng)操作popup工具(dialog工具也一樣是用open和close方法)
//重寫默認(rèn)alert事件
function alert(msg){
var _popup = $($.mobile.activePage).find('.msg_popup');
_popup.html('<p>'+msg+'</p>');
_popup.popup('open');
window.setTimeout(function(){
_popup.popup('close');
},2000);
}
?
8)ajax加載數(shù)據(jù)后重新宣染 標(biāo)簽
$('#goodslist').html(res).trigger('create');
轉(zhuǎn)載于:https://www.cnblogs.com/tujia/p/5338403.html
總結(jié)
以上是生活随笔為你收集整理的jquerymobile使用技巧的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。