Jquery Mobile pageLoading() Method how does it work?

最后都变了- 提交于 2019-12-12 22:05:43

问题


I am new to Jquery Mobile and attempting to learn it as I redevelop this mobile site. So I am doing all my navigation with different divs with data-role="page". and navigating with the #pagename. My question being doing my navigation this way how do I use the loading message and wait to make the transition until the next page is loaded? I tried putting the $.mobile.pageLoading() in the onClick attribute of the link but that didn't work.


回答1:


Using JQM 1.0 beta 1

//show
$.mobile.showPageLoadingMsg();

//hide
$.mobile.hidePageLoadingMsg();

http://jquerymobile.com/demos/1.0b1/#/demos/1.0b1/docs/api/methods.html

http://jquerymobile.com/test/docs/api/methods.html

Update:

This method is also the accepted way to do it in the official 1.0 release.

http://code.jquery.com/mobile/latest/demos/docs/api/methods.html

mobile.showPageLoadingMsg ()

Show the page loading message, which is configurable via $.mobile.loadingMessage. Example:

//cue the page loader 
$.mobile.showPageLoadingMsg();

$.mobile.hidePageLoadingMsg ()

Hide the page loading message, which is configurable via $.mobile.loadingMessage. Example:

//cue the page loader           
$.mobile.hidePageLoadingMsg();



回答2:


The documentation is here (at the bottom) http://jquerymobile.com/demos/1.0a4.1/#docs/api/methods.html but yeah it's a little vague on examples.

This might help you out: https://github.com/jquery/jquery-mobile/issues/1397




回答3:


In jQuery mobile 1.4.5 the only thing that helped me is: $('.ui-loader').hide();



来源:https://stackoverflow.com/questions/6085679/jquery-mobile-pageloading-method-how-does-it-work

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!