Run a fadein effect half way while a div is animating - Javascript jQuery Method and Property

Javascript examples for jQuery Method and Property:animate

Description

Run a fadein effect half way while a div is animating

Demo Code

ResultView the demo in separate window

<html lang="en">
 <head> 
  <style>
header {/*from   w w w .jav  a  2s . c  o  m*/
   width: 100%;
   height: 500px;
   background: blue;
   opacity: 0;
}


      </style> 
 </head> 
 <body translate="no"> 
  <header></header> 
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> 
  <script>
$('header')
.animate({marginTop: '-=100'}, 1000, 'linear')
.animate({marginTop: '-=100', opacity: 1}, 1000, 'linear');
    
      </script>  
 </body>
</html>

Related Tutorials