我想在我正在构建的网站的移动版本的图片库上拥有一些滑动功能,因此我一直在使用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