javascript - how to stop loading animation once the screen is loaded -


@import url(http://fonts.googleapis.com/css?family=play:400,700);  * {    box-sizing: border-box;  }    body {    background-color: #222;    font-family: "play";  }    h1 {    font-size: 2rem;    color: #fff;    text-align: center;    text-transform: uppercase;  }    .smart-glass {    position: absolute;    margin: auto;    left: 0;    top: 0;    right: 0;    bottom: 0;    width: 288px;    height: 388px;  }    .logo {    width: 288px;    height: 288px;    position: relative;  }    .circle {    padding: 20px;    border: 6px solid transparent;    border-top-color: #40a800;    border-radius: 50%;    width: 100%;    height: 100%;    animation: connect 2.5s linear infinite;  }    .xbox {    background: #fff;    width: 80px;    height: 80px;    border-radius: 100%;    overflow: hidden;    position: absolute;    top: 0;    right: 0;    left: 0;    bottom: 0;    margin: auto;  }  .xbox:after, .xbox:before {    content: "";    display: block;    border-top: 10px solid #222;    border-radius: 50%;    height: 90%;    width: 120%;    transform: rotate(-45deg);    position: absolute;    right: -30%;    top: 15%;  }  .xbox:before {    left: -30%;    transform: rotate(45deg);  }    .loading-text {    text-transform: uppercase;    color: #fff;    text-align: center;    margin: 10px 0;    font-size: 1.4rem;  }    @keyframes connect {    0% {      transform: rotate(0deg);    }    100% {      transform: rotate(-360deg);    }  }
<div class="smart-glass">    <h1>xbox</h1>    <div class="logo">      <div class="circle">        <div class="circle">            <div class="circle">            </div>        </div>    </div>    <div class="hold-x">      <div class="xbox"></div>     </div>    </div>    <div class="loading-text">      loading...    </div>  </div>

well saw loading animation on 1 website , planning insert code problem having how stop animation once page has completed loading. highly appreciated

you can first fadeout animated part , removethe dom content of it

 $(".smart-glass").fadeout(3000,function(){  // fade out in 3 secs   $(".smart-glass").remove();   // animated part removed dom   $('body').css('background-color',"#fff"); // background changed white  }) }) 

plunker


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -