jquery - 隐藏页面加载器微调器

标签 jquery spinner loader

我开发了一个登录页面。当用户按下登录按钮时,我会显示“加载器微调器”并显示第二个页面。但是,当用户在第二页中按后退按钮时,加载程序在第一页中仍然可见。我无法隐藏它。我该如何解决这个问题?有没有更简单的方法使用 AJAX 来做到这一点?我的代码:首页

enter code here
<!DOCTYPE html>
 <html>
<head>
 <title>Forms with jQM</title>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

<script>
 $(document).on("pagebeforehide","#plogin", function(event, ui) {
 $.mobile.loading('hide');
 });
</script>

 </head>
 <body>

 <div data-role="page" id="plogin">
 <div data-role="header"><h1>Forms with jQM</h1></div>
 <div data-role="content">
 <form id="login" name="login" action="http://www.vyingbrain.net/testajax.aspx" method="POST" class="hide-page-loading-msg">
 <div data-role="fieldcontain">
 <label for="username">Username: </label>
 <input type="text" name="usr" id="usrn" value="" /><br />
 </div>

 <div data-role="fieldcontain">
 <label for="password">Password:</label>
 <input type="password" name="pss" id="pass" value="" /><br />
 </div>

 <input type="hidden" name="hiddenInput" id="hiddenInput" value="secret message" />
 <input type="submit" name="loginSubmit" id="loginSubmit" value="Login" class="show-page-loading-msg" />
 </form>
</div>
</div>
<script>
 $(document).on("click", ".show-page-loading-msg", function() {
 var $this = $( this ),
 theme = $this.jqmData("theme") || $.mobile.loader.prototype.options.theme,
 msgText = $this.jqmData("msgtext") || $.mobile.loader.prototype.options.text,
 textVisible = $this.jqmData("textvisible") || $.mobile.loader.prototype.options.textVisible,
 textonly = !!$this.jqmData("textonly");
 html = $this.jqmData("html") || "";
 $.mobile.loading( 'show', {
 text: msgText,
 textVisible: textVisible,
 theme: theme,
 textonly: textonly,
 html: html
 });
 })
 .on("click", ".hide-page-loading-msg", function() {
 $.mobile.loading( 'hide' );
 });
 </script>
</body>
</html>

第二页:testajax.aspx

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestAjax.aspx.vb" Inherits="TestAjax" %>

<!DOCTYPE html">

<html>
<head runat="server">
 <title>JQuery Test</title>
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css" />
 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
 <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>

</head>
<body>
<div data-role="page">
<div data-role="header"><h1>TestAjax</h1></div>
<div data-role="content">
<a href="login.htm" data-rel="back" data-role="button">Go Back</a>
 <form id="form1" runat="server">
 <div>
 <asp:Label ID="lblDet" runat="server" Text="Label"></asp:Label>
 </div>
 </form>
</div>
</div>

</body>
</html>

最佳答案

尝试将其添加到您的脚本中

    window.onload = window.onpageshow = function () {
        $.mobile.loading('hide');
    };

关于jquery - 隐藏页面加载器微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19805250/

相关文章:

jquery翻转效果

javascript - jQuery 查找父标签

android - 实现带有微调器和复选框的自定义 ListView

IOS 应用程序加载器错误 "Unable to Parse application Info.plist for validation"

javascript - 将 'Blade' 附加到没有 'popping-down' 现有容器的容器中

javascript - 有什么好的工具可以自动化js脚本组合吗?

android - 如何更改工具栏中 AppCompatSpinner 的文本颜色?

android - 微调器数据内容不可见

php - Codeigniter 第三方,$this->load->add 包路径无法正常工作

flash - AS3 : streamlining a 'universal loader'