On Scroll Header Effects

Some inspiration for headers that animate when scrolling the page.
Header Effects

From our sponsor: Try Mailchimp today.

You’ve surely seen those really cool on scroll effects for headers that have been around lately. One example is the header on the Riot Industries website by Phil Renaud which rotates in 3d on click and enlarges when scrolling down. Similar work has been done by Johnny Simpson where he explores Scroll Activated Fixed Header Animations. We’ve also created a Blueprint for an On-Scroll Animated Header to get you started.

Today we’d like to give you some inspiration for animated headers and show you what kind of effects could be used to spice up your website’s starting element and give it some life.

Please note: this only works as intended in browsers that support the respective CSS properties. Modern browsers only!

The demo for the effects serves as inspiration only and we’ve used a technique that involves changing the state classes of the header which would of course be customized depending on which effect would like to be used. It’s important to understand that the states depend on each other, i.e. changing from class A to class B does something (using transitions) and going from A to C might not cause the desired effect. So the order matters in this example that tries to show all the effects on one page.

Also note that scrolling super fast might cause a jump from the beforementioned class A to class C which might not always look very fancy.

In the demo we use the fantastic jQuery Waypoints plugin by Caleb Troughton.

The header is composed of various parts for showcasing all the effects. It has a perspective wrapper, a front and a bottom (for the 3d rotation):

<header id="ha-header" class="ha-header ha-header-large">
	<div class="ha-header-perspective">
		<div class="ha-header-front">
			<h1><span>Header Effects</span></h1>
				<a>‹ Previous Demo</a>
				<a>Back to the article</a>
		<div class="ha-header-bottom">

We add a special class to the sections which will trigger the class change:

<section class="ha-waypoint" data-animate-down="ha-header-small" data-animate-up="ha-header-large">
	<!-- ... -->

The data atrributes are used for setting the right classes depending on which direction we are scrolling. In our demo the animate-up data attribute contains the class of the previous animate-down one.

An example for a state class is the following “rotate” one:

.ha-header-rotate {
	height: 220px;
	top: 50px;
	padding-left: 50px;
	padding-right: 50px;

.ha-header-rotate .ha-header-front {
	transform: translateY(-100%) rotateX(90deg);

.ha-header-rotate .ha-header-bottom {
	top: 50%;
	transition: transform 0.5s;
	transform: rotateX(0deg) translateY(-100%);

The state classes are applied to the header element and from there we can define some changes for the children.

With the help of the Waypoints plugin we simply add the respective classes:

var $head = $( '#ha-header' );
$( '.ha-waypoint' ).each( function(i) {
	var $el = $( this ),
		animClassDown = $el.data( 'animateDown' ),
		animClassUp = $el.data( 'animateUp' );

	$el.waypoint( function( direction ) {
		if( direction === 'down' && animClassDown ) {
			$head.attr('class', 'ha-header ' + animClassDown);
		else if( direction === 'up' && animClassUp ){
			$head.attr('class', 'ha-header ' + animClassUp);
	}, { offset: '100%' } );
} );

We hope you enjoy the effects and that they give you some inspiration on how to make a fancy animated header.

Tagged with:

Mary Lou

ML is a freelance web designer and developer with a passion for interaction design. She studied Cognitive Science and Computational Logic and has a weakness for the smell of freshly ground peppercorns.


Stay up to date with the latest web design and development news and relevant updates from Codrops.

Feedback 64

Comments are closed.
  1. What a great story that was, but the header kept doing these weird things as I scrolled down… haha jk, awesome effects!

  2. You’re great as always. 🙂
    just a little push : allow text selection when the header is hidden.
    component.css:228 :
    .ha-header-hide { ... /*++*/ top: -220px; ... }

  3. I’m trying to combine these header effects with the multilevel push menu…. for some reason I can’t get waypoint to detect when the .scroller or scroller-inner is scrolling. It always is expecting the viewport to scroll, but it doesn’t with the push menu. Any thoughts on getting Waypoint to detect when a div is scrolling and not rely on the viewport?

  4. Hi..
    Could you help me please..
    can i use your source code to blogger?, Where can i add the section?

    I wish to make my header and my menu appear initially, (in your code is “ha-header-subshow”).
    and then when its scrolled down , it will show My Menu Bar only..

    Thank you.

  5. This works great, however, I am trying to do something slightly different. I would like my header to animate at the end of a section rather than the beginning. Ie: I have a full screen (responsive) image on the splash screen. Once the user scrolls past this image (the image disappears off the top of the page), the menu would appear. Similar to http://www.catscarf.com/ . How can I achieve this?

    • Look into the offset settings for waypoints. I think you need to set it to 0 on the for the following element.

  6. Hi Mary,

    Can you please let me know – on 3rd click it working fine scrolling down. how to stat scroll on 1st scrolling down.


  7. Thx for your work… is great.
    Could you help me please. how i can in “box” effect expand menu after click on box?
    (sorry for my english)

    thank you

  8. Hi, I tried to use your HeaderEffects with this scrolling effect on my website:
    I have tried every single thing but these header effects do not work on this template.
    I really like your work and wish to use it in my project.
    Please reply as soon as possible!

  9. Hi, thanks for this, it’s a real help – (posting this on the correct page).
    If I want to change the state of the class using waypoints based on the % scroll or px down the page – what would be the script to use at the bottom of the page?
    The reason being, not all of the pages within my website have specific waypoints that I want trigger a scrolling header animation. In this case It would be best if it were standardised across the whole site with the same rule – px or % so the user experience is consistent.
    Look forward to your reply/help on this
    Best regards, John