jQuery Mobile里xxx怎么用呀? (事件篇)
生活随笔
收集整理的這篇文章主要介紹了
jQuery Mobile里xxx怎么用呀? (事件篇)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
http://app-framework-software.intel.com/
http://app-framework-software.intel.com/api2/#$_proxy
?
?
jQuery Mobile里$(document).ready()怎么用呀?
相關(guān)鏈接:
-
- http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events
- http://jquerymobile.com/demos/1.2.1/docs/api/events.html
- http://jquerymobile.com/demos/1.0.1/docs/pages/page-scripting.html
注意事項(xiàng):
-
- Use $(document).bind('pageinit/pageshow'), not $(document).ready()
- 默認(rèn)設(shè)置下,jQueryMobile網(wǎng)站第一個(gè)頁(yè)面之后的所有頁(yè)面都是使用AJAX去加載的,而document.ready只會(huì)在第一個(gè)頁(yè)面加載時(shí)執(zhí)行,that's why not document.ready.
- 相對(duì)應(yīng)的,pageinit/pageshow事件則像是加載頁(yè)面AJAX代碼的一個(gè)回調(diào)(callback)函數(shù),請(qǐng)求成功后便觸發(fā)執(zhí)行
jQuery Mobile里mobileinit event怎么用呀?
相關(guān)鏈接:
-
- http://jquerymobile.com/demos/1.2.1/docs/api/globalconfig.html
mobileinit事件的作用:
-
- 更改默認(rèn)設(shè)置(To override default settings)
- 在page加載之前綁定事件處理函數(shù)(bind pageshow/pageinit event handlers before page is loaded)
注意事項(xiàng):
-
- mobileinit事件處理函數(shù)的代碼一定要放在在jquery加載之后,jquerymobile加載之前
- <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
$(document).on("mobileinit", function(){$(document).on('pageshow', 'div:jqmData(role="page"), div:jqmData(role="dialog")', function(event){//pageshow handler goes here
});$(document).on('pageinit', function() { //pageinit handler goes here
});
});
</script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
?
jQuery Mobile里page事件觸發(fā)順序是怎樣的?
First all events can be found here:?http://api.jquerymobile.com/category/events/
-
- pagebeforeload,?pageload?and?pageloadfailed?are fired when an external page is loaded
- pagebeforechange,?pagechange?and?pagechangefailed?are page change events. These events are fired when a user is navigating between pages in the applications.
- pagebeforeshow,?pagebeforehide,?pageshow?and?pagehide?are page transition events. These events are fired before, during and after a transition and are named.
- pagebeforecreate,?pagecreate?and?pageinit?are for page initialization.
- pageremove?can be fired and then handled when a page is removed from the DOM
Page loading jsFiddle example:?http://jsfiddle.net/Gajotres/QGnft/
?
(以上內(nèi)容copy自http://stackoverflow.com/questions/14468659/jquery-mobile-document-ready-vs-page-events,有那么好的講解我為什么不用!)
轉(zhuǎn)載于:https://www.cnblogs.com/wicub/p/3425537.html
總結(jié)
以上是生活随笔為你收集整理的jQuery Mobile里xxx怎么用呀? (事件篇)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 函数对象 函数嵌套 名称空间与作用域
- 下一篇: 通过腾讯地图服务获取行政区划信息