我想在我正在構建的網站的移動版本的圖片庫上擁有一些滑動功能,因此我一直在使用jQuery,我以爲我會使用jQuery Mobile swipeleft
和swiperight
事件。這一切工作正常,但我注意到,當頁面加載時,我得到一個字加載出現在頁面上。jQuery Mobile Loading
這是加載小部件?如果是的話,我怎樣才能設置它,使其不顯示?
我想在我正在構建的網站的移動版本的圖片庫上擁有一些滑動功能,因此我一直在使用jQuery,我以爲我會使用jQuery Mobile swipeleft
和swiperight
事件。這一切工作正常,但我注意到,當頁面加載時,我得到一個字加載出現在頁面上。jQuery Mobile Loading
這是加載小部件?如果是的話,我怎樣才能設置它,使其不顯示?
你可以把它與一個:
$(document).bind('mobileinit', function(){
$.mobile.loader.prototype.options.text = "loading";
$.mobile.loader.prototype.options.textVisible = false;
$.mobile.loader.prototype.options.theme = "a";
$.mobile.loader.prototype.options.html = "";
});
這也是很好的知道,之前的jQuery Mobile是一個頭腦裏初始化該塊必須初始化,就像這樣:
<!DOCTYPE html>
<html>
<head>
<title>jQM Complex Demo</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=no; target-densityDpi=device-dpi"/>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
<script src="http://www.dragan-gaic.info/js/jquery-1.8.2.min.js"></script>
<script>
$(document).bind('mobileinit', function(){
$.mobile.loader.prototype.options.text = "loading";
$.mobile.loader.prototype.options.textVisible = false;
$.mobile.loader.prototype.options.theme = "a";
$.mobile.loader.prototype.options.html = "";
});
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
</head>
查找有關此功能的更多信息here。
試試這個:
$(document).on("swiperight", "body", function() {
$.mobile.changePage("#page1");
$.mobile.hidePageLoadingMsg();
});
OR
$("body").on("swipeleft swiperight", function(event) {
$.mobile.changePage("#page1");
$.mobile.hidePageLoadingMsg();
});
但是你做到這一點,最重要的部分是
$.mobile.hidePageLoadingMsg();
你的答案和指針關於之前初始化塊感謝@Gajotres在頭標籤中初始化jQuery Mobile。 – user1563944 2013-03-06 00:06:08