PHP Classes

File: web/assets/plugins/animated-header/cbpAnimatedHeader.js

Recommend this page to a friend!
  Classes of Felix Ivan Romero Rodríguez   PHP Web Socket Chat   web/assets/plugins/animated-header/cbpAnimatedHeader.js   Download  
File: web/assets/plugins/animated-header/cbpAnimatedHeader.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP Web Socket Chat
Chat system using Websockets or AJAX requests
Author: By
Last change:
Date: 7 years ago
Size: 1,055 bytes
 

Contents

Class file image Download
/** * 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-inner' ), headerwrap = document.querySelector( '.front-header' ), 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-inner-shrink' ); classie.add( headerwrap, 'front-header-shrink' ); } else { classie.remove( header, 'navbar-inner-shrink' ); classie.remove( headerwrap, 'front-header-shrink' ); } didScroll = false; } function scrollY() { return window.pageYOffset || docElem.scrollTop; } init(); })();