欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

淺析jQuery Mobile的初始化事件

 更新時(shí)間:2015年12月03日 16:20:35   投稿:goldensun  
這篇文章主要介紹了淺析jQuery Mobile的初始化事件,jQuery是當(dāng)前人氣最高的JavaScript庫,需要的朋友可以參考下

jQuery Mobile 包括一個(gè)初始化事件,該事件甚至?xí)扔?jQuery 的 document.ready 事件進(jìn)行加載。jQuery Mobile 實(shí)際上在文檔對(duì)象本身上觸發(fā)其初始化事件,第一個(gè)觸發(fā)的事件是mobileinit。

當(dāng)Jquery Mobile開始執(zhí)行時(shí),他就會(huì)在document對(duì)象上觸發(fā)mobileinit 事件,因?yàn)閙obileinit事件是在加載后馬上觸發(fā),所以你需要在Jquery Mobile加載之前綁定你的事件處理函數(shù),所以我建議你如下安排你的js引用順序

<script src="Jquery.js"></script>
<script src="您自己的js文件"></script>
<script src="Jquery-mobile.js"></script>

要擴(kuò)展 mobileinit 事件,您首先需要將它與一個(gè)自定義函數(shù)進(jìn)行綁定??墒褂?bind 方法擴(kuò)展 mobileinit 事件,來覆蓋默認(rèn)配置(全局選項(xiàng))。

$(document).bind("mobileinit", function(){
//覆蓋的代碼
});

 

在綁定事件的函數(shù)內(nèi)部,你可以使用$.mobile對(duì)象的$.extend方法來配置默認(rèn)參數(shù)值:

$(document).bind("mobileinit", function(){
 $.extend( $.mobile , {
 foo: bar
 });
});

或者單獨(dú)設(shè)置它。

$(document).bind("mobileinit", function(){
 $.mobile.foo = bar;
});

 

$.mobile 對(duì)象是設(shè)置所有屬性的起始點(diǎn)

<script type="text/java script" src="/scripts/jquery-1.6.min.js"></script>
<script type="text/java script">
$(document).bind("mobileinit", function(){
$.mobile.defaultTransition = "slidedown";
$.mobile.ajaxLinksEnabled = false; // 禁用Ajax提交
$.mobile.ajaxFormsEnabled = false; // 禁用Ajax提交
$.mobile.ajaxEnabled = false; //禁用Ajax提交
});
</script>
<script type="text/java script" src="/scripts/mobile/jquery.mobile-1.0b1.min.js"></script>

相關(guān)文章

最新評(píng)論