简体   繁体   English

如何在Squarespace之类的网页上制作预加载器

[英]How would I be able to make a preloader on a webpage like Squarespace

Recently I've been thinking about working on a new website layout, but I've come across lots of inspiration lately, but with no luck of finding how to implement them into my project. 最近,我一直在考虑使用一种新的网站布局,但是最近我遇到了很多灵感,但是没有找到如何将它们实现到我的项目中的运气。 One of these problems include preloading an image before allowing the webpage the load exactly like how Squarespace presents their website with a preloaded image of their logo and then a quick transition to their webpage. 这些问题之一包括,在完全允许网页加载之前,先预加载图片,就像Squarespace向其网站展示其徽标的预加载图片的方式一样,然后快速过渡到其网页。 I tried to look at their source code, but with no luck of finding how they did it or what they used (Jquery?/Javascript?). 我试图查看他们的源代码,但是没有找到他们是如何做的或使用了什么(Jquery?/ Javascript?)。 I have no Idea. 我不知道。 I did some research, but most of them consist of "progress bars" which I do not want, I would just like to emulate Squarespace with an image and a nice background then transition into my webpage. 我做了一些研究,但其中大多数都是我不想要的“进度条”,我只想用图像和漂亮的背景模拟Squarespace,然后过渡到我的网页。 Would anyone be willing to demonstrate how to do so? 有人愿意演示如何做吗? Thank you all in advance. 谢谢大家。

PS I am still learning JavaScript and Jquery, but I am just fascinated in how people come up with these implementations. PS:我仍在学习JavaScript和Jquery,但我只是着迷于人们如何提出这些实现。

Here is the website link to make things easier: http://www.squarespace.com/ You can see at the beginning a logo loads before the whole website loads, that's what my question revolves around. 这是使网站变得更容易的网站链接: http : //www.squarespace.com/您可以在开始时看到徽标在整个网站加载之前加载,这就是我的问题。

Wanna try this one? 想尝试这个吗?

Tutorial site http://jquerybyexample.blogspot.com/2012/06/show-loading-image-while-page-is.html 教程网站http://jquerybyexample.blogspot.com/2012/06/show-loading-image-while-page-is.html

HTML 的HTML

<div id="dvLoading"></div>

CSS 的CSS

#dvLoading{
   background:#000 url(images/loader.gif) no-repeat center center;
   height: 100px;
   width: 100px;
   position: fixed;
   z-index: 1000;
   left: 50%;
   top: 50%;
   margin: -25px 0 0 -25px;
}

JS JS

<script>
    $(window).load(function(){
       $('#dvLoading').fadeOut(2000);
    });
</script>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM