如何在网站上添加加载效果?

时间:2015-08-06 04:18:13

标签: html css

我正在网站上工作,但我不知道页面加载效果。 我尝试过使用网站[http://www.realcombiz.com/2013/12/35-amazing-loading-animation-effects.html]中显示的效果,但它只是在网站上显示动画,而不是在页面加载时显示。

2 个答案:

答案 0 :(得分:0)

您需要在加载函数上添加加载图像或样式 -

$(window).load(function() {      

});



$(window).load(function() {      
  	$("#loader").fadeOut("fast");
});

body{
	background:url('http://www.artswallpapers.net/minimalist-abstract-wallpapers/images/104.jpg');
}
#loader{
	background: url('https://d13yacurqjgara.cloudfront.net/users/34535/screenshots/631316/loader_gif.gif');
	height:100px;
	width:100px;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="loader">
		
	</div>
	<div class="wrap">

	</div>
&#13;
&#13;
&#13;

答案 1 :(得分:0)

Check this out ,it shows the first loading effect in your link given

HTML

<div id="overlay">
    <!--  <img src="http://cdn.nirmaltv.com/images/generatorphp-thumb.gif" alt="Wait" alt="Loading" />-->
    <div class="circ">
  <div class="load">Loading...</div>
  <div class="hands"></div>
  <div class="body"></div>
  <div class="head">
    <div class="eye"></div>
  </div>
</div>
<div id="overlayText">


        </div>
    </div>
    <div id="container"  >

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
    </div>

Jquery的

    //  1.0);This sets the opacity to 100% on hover },function(){ 


var delay = 3000;
setTimeout(function() 

    {  

        $( "#overlay" ).fadeOut( "slow" );

         $('#container').fadeIn();

    },
    delay
) ;

CSS

#overlayText{
     position:absolute;
    top:365px;
    left: 330px;

   z-index:11;

}

#container{
    position:relative;
       display:none;
}
#overlay{

  width:100%;
    height:100%;
    position: absolute;
    top:0px;
    z-index: 2;
    background-color:#222;
    opacity:0.7;



}

@import url(http://fonts.googleapis.com/css?family=Julius+Sans+One);
html{width: 100%;height: 100%;}


.eye{
  width: 20px; height: 8px;
  background-color: #eee;
  border-radius:0px 0px 20px 20px;
  position: relative;
  top: 40px;
  left: 10px;
  box-shadow:  40px 0px 0px 0px #eee;              
}

.head{
  -webkit-backface-visibility: hidden;
  position: relative;
  margin: -250px auto;
  width: 80px; height: 80px;
  background-color: #111;
  border-radius:50px;
  box-shadow: inset -4px 2px 0px 0px #eee;
    -webkit-animation:node 1.5s infinite alternate;
  -webkit-animation-timing-function:ease-out;
}
.body{ 
  position: relative;
  margin: 90px auto;
  width: 140px; height: 120px;
  background-color: #111;
  border-radius: 50px/25px ;
  box-shadow: inset -5px 2px 0px 0px #eee;
  -webkit-animation:node2 1.5s infinite alternate;
  -webkit-animation-timing-function:ease-out;  
}

  @-webkit-keyframes node 
      {
         0%{ top:0px; }
         50%{ top:10px; }
         100% { top:0px;} 
       }

  @-webkit-keyframes node2
      {
         0%{ top:-5px; }
         50%{ top:10px; }
         100% { top:-5px;} 
       }

.circ{
  -webkit-backface-visibility: hidden;
   margin: 60px auto;
  width: 180px; height: 180px;
  background-color: #111;
  border-radius: 0px 0px 50px 50px;
  position: relative;
  z-index: -1;  
  left: 0%;
  top: 20%;
  overflow: hidden;
}

.hands{
  -webkit-backface-visibility: hidden;
  margin-top: 140px;
  width: 120px;height: 120px;
  position: absolute;
  background-color: #111;
  border-radius:20px;
  box-shadow:-1px -4px 0px 0px #eee;
  -webkit-transform:rotate(45deg);
  top:75%;left: 16%;
  z-index: 1;
  -webkit-animation:node2 1.5s infinite alternate;
  -webkit-animation-timing-function:ease-out;
}

.load{  position: absolute;
  width: 100px; height: 20px;
   margin: -10px auto;
  -webkit-font-smoothing: antialiased;
  font-family: 'Julius Sans One', sans-serif;
  font-size:30px;
  font-weight:400;
  color:#eee;
  left: 10%;
  top: 5%;
}