【问题标题】:Loading gif until page completely loads加载 gif 直到页面完全加载
【发布时间】:2015-03-09 12:46:24
【问题描述】:

我正在尝试显示加载 GIF 并显示它直到页面完全加载。

这是我的 jQuery/Javascript 代码:

$(document).ready(function(){
   $('#myTab a').on('load', function (e) {
        e.preventDefault();
        $(this).tab('show');
    },onLoadSomeFunction());
}

onLoadSomeFunction() 引导我的页面获取一些值并将它们加载到其中。

在所有页面加载过程结束之前,如何显示我的加载 gif?

【问题讨论】:

    标签: javascript php jquery


    【解决方案1】:
        please try this:- 
    $(document).ready(function(){
           $('#myTab a').on('load', function (e) {
                e.preventDefault();
          $(this).tab('show'); or $('#load_img/message').show();// div having loading image/message and initially property hidden
    
            },onLoadSomeFunction()); or success : function(html){
                   //your functionality after success
                     $('#load_img/message').hide(); // hide the loading image/message
                }
        }
    

    【讨论】:

      【解决方案2】:

      //Try using this following code
      <img src="loader.gif" class="gif_image"/>
      
      //Jquery
      $(document).ready(function(){  
         
         $('#myTab a').on('load', function (e) {
              e.preventDefault();
              $(this).tab('show');
          },onLoadSomeFunction());
      }
      
      $(window).load(function()
      {
         $('.gif_image').hide();
      }); 

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2020-07-14
        • 1970-01-01
        • 2023-03-05
        • 1970-01-01
        • 1970-01-01
        • 2016-07-16
        • 1970-01-01
        相关资源
        最近更新 更多