1/** 2 * Sticky Header 3 * 4 * Copyright 2017 ThemeZee 5 * Free to use under the GPLv2 and later license. 6 * http://www.gnu.org/licenses/gpl-2.0.html 7 * 8 * Author: Thomas Weichselbaumer (themezee.com) 9 * 10 * @package Poseidon 11 */ 12 13(function($) { 14 15 /**-------------------------------------------------------------- 16 # Sticky Header 17 --------------------------------------------------------------*/ 18 $.fn.stickyHeader = function() { 19 20 var body = $( 'body' ), 21 top_position = $( this ).offset().top - body.offset().top - 1, 22 header_height = $( this ).height() + top_position, 23 small_header = top_position + 70; 24 25 var makeSticky = function() { 26 27 var window_top = $( window ).scrollTop(); 28 29 if ( window_top > top_position ) { 30 31 body.addClass( 'sticky-header' ); 32 body.css( 'padding-top', header_height + 'px' ); 33 34 } else { 35 36 body.removeClass( 'sticky-header' ); 37 body.css( 'padding-top', '0' ); 38 39 } 40 41 if ( window_top > small_header ) { 42 body.addClass( 'small-header' ); 43 } else { 44 body.removeClass( 'small-header' ); 45 } 46 } 47 48 makeSticky(); 49 50 $( window ).scroll( makeSticky ); 51 52 }; 53 54 /**-------------------------------------------------------------- 55 # Setup Sticky Header 56 --------------------------------------------------------------*/ 57 $( document ).ready( function() { 58 59 /* Add Sticky Header feature */ 60 $( '.site-header' ).stickyHeader(); 61 62 } ); 63 64}(jQuery));
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.