Javascript 我使用的是Rails 5,我使用css创建了一个自定义页面加载器。我想做的是在加载任何页面之前先显示这个页面加载器?

Javascript 我使用的是Rails 5,我使用css创建了一个自定义页面加载器。我想做的是在加载任何页面之前先显示这个页面加载器?,javascript,jquery,html,ruby-on-rails,css,Javascript,Jquery,Html,Ruby On Rails,Css,我怎样才能做到这一点?我的Jquery代码是什么?我应该把它放在哪里 这是我的页面加载器css body { background: #000000; text-align: center; padding: 20%; letter-spacing: 7px; } .loading span { display: inline-block; vertical-align: middle; width: 15px; height: 15px; margin: .19em;

我怎样才能做到这一点?我的Jquery代码是什么?我应该把它放在哪里

这是我的页面加载器css

body {
background: #000000;
text-align: center;
padding: 20%;
letter-spacing: 7px;
}

.loading span {
  display: inline-block;
  vertical-align: middle;
  width: 15px;
  height: 15px;
  margin: .19em;
  background: #ffffff;
  border-radius: 10px;
  /*transform: translate3d(-50%,-50%,0);*/
  animation: loading 1.3s infinite;

  }

  .loading span:nth-of-type(1){
   width: 10px;
   height: 10px;
   background: #ffffff;
    border-radius: 10px;
   animation-delay: 0.1s;
   }


.loading span:nth-of-type(3) {
 height: 10px;
 width: 10px;
 border-radius: 10px;
  background:   #ffffff;
 animation-delay: 0.5s;
}
这是我的登录html页面,但在显示此页面或任何其他页面之前,我想先显示我的加载程序

  <!DOCTYPE html>
   <html >
   <head>
  <meta charset="UTF-8">
  <title>Login page</title>

   </head>

    <body>
   <div class="loading">
    <span></span>     
      <span></span>
         <span></span>
          </div>
        <div class="login-form">
       <%= form_for(:user) do |f|%>
     <div class="form-group">
     <%= f.text_field :username, class: 'form-control', placeholder: "Username" %>
       <i class="glyphicon glyphicon-user"></i>
       </div>
       <div class="form-group pass">
           <%= f.password_field :password, class: 'form-control', placeholder: "Password" %>
       <i class="glyphicon glyphicon-lock"></i>
       </div>

       <%= f.label :remember_me, class: "checkbox" do %>
       <%= f.check_box :remember_me %>
       <span>Remember me</span>
       <% end %>


      <button class="log-btn btn btn-primary"  >Sign In</button>
      <% end %>



     <a href="https://rails-muneebzak6502.c9users.io/profile/help" class="link-1">
      Forgot Password?</a>


     </div>


      </body>

      </html>

登录页面
记得我吗
登录

如何首先显示加载程序,然后显示用户调用的页面?我应该使用什么Jquery以及在哪里使用它,因此它包含在整个应用程序中。

您想在显示页面之前还是在用户按下登录按钮之后显示微调器?每次用户请求页面时,我的自定义加载程序都应该先显示,然后再显示页面@Wuker:这不是Rails通常的请求/响应周期的工作方式。我想你要想有这样的行为,必须要经历很多困难。投票结束这个问题,因为问题太广泛了。