如何在网站内容加载时显示加载html页面? [英] How to display a loading html page while site content loads?

查看:130
本文介绍了如何在网站内容加载时显示加载html页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个包含大量MP3和图像的网站,这显然有一些加载时间。我想在加载所有内容时显示加载页面。

I am working on a site which contains a whole bunch of MP3s and images, which obviously got some loading time. I'd like to display a loading page while all the content loads.

我不知道如何实现这一点,但我确实使用了我想要使用的动画gif 。

I have no idea how to achieve this, but I do have the animated gif I want to use.

有什么建议吗?

推荐答案

所以基本上你做了一个预加载器100%的视口宽度和高度,设置一个背景颜色和你的GIF。

So basically you make a preloader with 100% width and height of the viewport, set a background color and your GIF on it. What the following JS does, is wait until everything has loaded and then the preloader fades out.

$(window).load(function(){
  $('#preloader').fadeOut('300', function(){
    $(this).remove();
  });
});

这篇关于如何在网站内容加载时显示加载html页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆