New Pen: Header scroll effect

Recently I had to develop one-pager, that had complicated animation in the header, that should progress forward/backward on page scroll. Because the page had to be very light, I decided to drop jQuery and TimelineMax and include only TweenLite and CSSPlugin. Here is the result:

See the Pen Page Header animation by Chrysto (@bassta) on CodePen.850

The script is very compact, easy to use and modify, cross-browser ( Actually DOMContentLoaded is supported IE9+ ).

Have fun forking and modifying it.

Smooth page scrolling with TweenMax

Override default jQuery animate() method with GSAP

When it comes to animation, Greensock Animation Platform (GSAP) is one of the most popular platforms around. It is available in both JavaScript and ActionScript with similar syntax and is amazingly fast. Actually, it performs up to 20 times faster than than jQuery’s native animate() method! It is very easy to use it in your project, thanks to greensock’s awesome plugin that overrides default jQuery animate() method and use TweenLight/TweenMax under the hood. All you have to do is to include TweenMax and the plugin and you’re done.

<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/TweenMax.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/latest/jquery.gsap.min.js"></script>

Once you’ve included the plugin you’re able to use the full power ot TweenMax – it is possible to tween CSS properties such as color, box-shadow, text-shadow, 2D and 3D transforms, background position and many more. GSAP use the same syntax as jQuery and takes care of browser specific code, such as vendor prefixes.