javascript - How can call a selected class on window.onload -


i have made simple javascript during window.onload fades in body when finished.

i want create overlay specific class instead shall reverse. want overlay fade out , after animation object destroyed or set display:none.

<style>  	body {  		opacity: 0;  		transition: opacity 500ms ease-in-out;  		}  </style>  <script>window.onload = function() {settimeout(function(){document.body.style.opacity="100";},500);};</script>

how accomplish in best way possible?

you asked jquery tag anwser jquery code.

$(function() {      var $overlay = $('#overlay');          $overlay.css('opacity', 0);          settimeout(function() {         $overlay.remove();      }, 500);  });
#overlay {      position: fixed;      top: 0;      right: 0;      bottom: 0;      left: 0;      background-color: white;      transition: opacity 500ms;  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div>    text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text     </div>    <div id="overlay"></div>


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -