1/** 2 * This script adds the jquery effects to the Infinity Pro Theme. 3 * 4 * @package Infinity\JS 5 * @author StudioPress 6 * @license GPL-2.0+ 7 */ 8 9( function($) { 10 11 var $body = $( 'body' ), 12 $content = $( '.offscreen-content' ), 13 headerHeight = $( '.site-header' ).height(), 14 $siteHeader = $( '.site-header' ), 15 $siteInner = $( '.site-inner' ), 16 sOpen = false, 17 windowHeight = $(window).height(); 18 19 $(document).ready(function() { 20 21 // Match height for content and sidebar. 22 $( '.content, .sidebar' ).matchHeight({ 23 property: 'min-height' 24 }); 25 26 // Set offscreen container height. 27 $( '.offscreen-container' ).css({ 28 'height': windowHeight + 'px' 29 }); 30 31 // Toggle the offscreen content. 32 $( '.offscreen-content-toggle' ).click(function() { 33 __toggleOffscreenContent(); 34 }); 35 36 }); 37 38 // Add white class to site container after 50px. 39 $(document).on( 'scroll', function() { 40 41 if ( $(document).scrollTop() > 50 ) { 42 $( '.site-container' ).addClass( 'white' ); 43 44 } else { 45 $( '.site-container' ).removeClass( 'white' ); 46 } 47 48 }); 49 50 // Push the .site-inner down dependant on the header height. 51 if ( ! $body.hasClass( 'front-page' ) ) { 52 53 __repositionSiteHeader( headerHeight, $siteInner ); 54 55 $(window).resize(function() { 56 57 // Update header height value. 58 headerHeight = $siteHeader.height(); 59 __repositionSiteHeader( headerHeight, $siteInner ); 60 61 62 }); 63 64 } 65 66 // Function to toggle the offscreen content. 67 function __toggleOffscreenContent() { 68 69 if (sOpen) { 70 $content.fadeOut(); 71 $body.toggleClass( 'no-scroll' ); 72 sOpen = false; 73 } else { 74 $content.fadeIn(); 75 $body.toggleClass( 'no-scroll' ); 76 sOpen = true; 77 } 78 79 } 80 81 // Function to get the CSS value of the position property of the passed element. 82 function __getPositionValue( selector ) { 83 84 var position = $( selector ).css( 'position' ); 85 86 return position; 87 88 } 89 90 // Function to position the site header. 91 function __repositionSiteHeader( headerHeight, $siteInner ) { 92 93 if ( 'fixed' == __getPositionValue( '.site-header' ) ) { 94 $siteInner.css( 'margin-top', headerHeight + 'px' ); 95 } else { 96 $siteInner.removeAttr( 'style' ); 97 } 98 99 } 100 101})(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.