Sha256: ecc786c184392b0e42c130062ce24e21044570b3f6e54c397d069295f938092b

Contents?: true

Size: 876 Bytes

Versions: 107

Compression:

Stored size: 876 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-fixed-top' ),
		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

107 entries across 107 versions & 3 rubygems

Version Path
ufo-5.0.7 docs/js/cbpAnimatedHeader.js
ufo-5.0.6 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.7 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.6 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.5 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.4 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.3 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.2 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.1 docs/js/cbpAnimatedHeader.js
ufo-5.0.5 docs/js/cbpAnimatedHeader.js
ufo-5.0.4 docs/js/cbpAnimatedHeader.js
ufo-5.0.3 docs/js/cbpAnimatedHeader.js
ufo-5.0.2 docs/js/cbpAnimatedHeader.js
ufo-5.0.1 docs/js/cbpAnimatedHeader.js
ufo-5.0.0 docs/js/cbpAnimatedHeader.js
sonic-screwdriver-2.2.0 docs/js/cbpAnimatedHeader.js
ufo-4.6.3 docs/js/cbpAnimatedHeader.js
ufo-4.6.2 docs/js/cbpAnimatedHeader.js
ufo-4.6.1 docs/js/cbpAnimatedHeader.js
ufo-4.6.0 docs/js/cbpAnimatedHeader.js