Sha256: 867396f8174ebfbff5ee5b46a9e7823c6828a526449ad765f61e1ce8b6a0d150

Contents?: true

Size: 875 Bytes

Versions: 8

Compression:

Stored size: 875 Bytes

Contents

/**
 * cbpAnimatedHeader.js v1.0.0
 * http://www.codrops.com
 *
 * Licensed under the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * Copyright 2013, Codrops
 * http://www.codrops.com
 */
var cbpAnimatedHeader = (function() {

	var docElem = document.documentElement,
		header = document.querySelector( '.navbar-default' ),
		didScroll = false,
		changeHeaderOn = 300;

	function init() {
		window.addEventListener( 'scroll', function( event ) {
			if( !didScroll ) {
				didScroll = true;
				setTimeout( scrollPage, 250 );
			}
		}, false );
	}

	function scrollPage() {
		var sy = scrollY();
		if ( sy >= changeHeaderOn ) {
			classie.add( header, 'navbar-shrink' );
		}
		else {
			classie.remove( header, 'navbar-shrink' );
		}
		didScroll = false;
	}

	function scrollY() {
		return window.pageYOffset || docElem.scrollTop;
	}

	init();

})();

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
frontend-generators-0.2.0 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.1.2 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.1.1 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.1.0 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.0.6 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.0.4 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.0.3 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js
frontend-generators-0.0.2 assets/creative/app/assets/javascripts/creative/cbpAnimatedHeader.js