Html预加载器 - 延迟页面加载 [英] Html preloader - delay page load
问题描述
我需要一些关于我的新模板的帮助:)。在网页加载之前,我想展示一个preloader gif。我做了它,但它显示一点点,因为页面加载非常快。所以我想延迟页面(以2秒为例),而不会影响预加载器,所以它(预加载器)会出现2秒,直到页面加载完成。
这是我的代码(请注意,它不能在jsfiddle上运行,因为我无法上传.gif文件):jsfiddle.net/hLmxpsnw/
无论出于何种原因,您希望它使用setTimeout在这里完成代码
jQuery(document).ready(function($){
$(window).load(function(){
setTimeout(function(){
$('#preloader')。 fadeOut('slow',function(){
});
},2000); //设置时间
});
}); b
$ j rel =noreferrer> http://jsfiddle.net/harshdand/593Lqqnm/2/
I need some help with my new template :). Before the webpage loads I want to show a preloader gif. I done it, however it shows just a little, because the page loads very fast. So I would like to delay the page (with 2 seconds, as an exemple), without affecting the preloader, so it (the preloader) would appear for 2 seconds, so until the page loads.
Here is my code (note that it will not work on jsfiddle, because I can't upload the .gif file): jsfiddle.net/hLmxpsnw/
解决方案 For whatever reason u want it its done using setTimeout here is the code
jQuery(document).ready(function ($) {
$(window).load(function () {
setTimeout(function(){
$('#preloader').fadeOut('slow', function () {
});
},2000); // set the time here
});
});
jsfiddle http://jsfiddle.net/harshdand/593Lqqnm/2/
这篇关于Html预加载器 - 延迟页面加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!