1/** 2 * cbpAnimatedHeader.js v1.0.0 3 * http://www.codrops.com 4 * 5 * Licensed under the MIT license. 6 * http://www.opensource.org/licenses/mit-license.php 7 * 8 * Copyright 2013, Codrops 9 * http://www.codrops.com 10 */ 11var cbpAnimatedHeader = (function() { 12 13 var docElem = document.documentElement, 14 header = document.querySelector( '.navbar-fixed-top' ), 15 didScroll = false, 16 changeHeaderOn = 300; 17 18 function init() { 19 window.addEventListener( 'scroll', function( event ) { 20 if( !didScroll ) { 21 didScroll = true; 22 setTimeout( scrollPage, 250 ); 23 } 24 }, false ); 25 } 26 27 function scrollPage() { 28 var sy = scrollY(); 29 if ( sy >= changeHeaderOn ) { 30 classie.add( header, 'navbar-shrink' ); 31 } 32 else { 33 classie.remove( header, 'navbar-shrink' ); 34 } 35 didScroll = false; 36 } 37 38 function scrollY() { 39 return window.pageYOffset || docElem.scrollTop; 40 } 41 42 init(); 43 44})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.