1/** 2 * This script adds the jquery effects to the Hello Coach Theme. 3 * 4 * @package HelloCoach 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); 102 103jQuery(function( $ ){ 104 105$('#main-nav-search-link').click(function(){ 106$('.search-div').show('slow'); 107}); 108 109$("*", document.body).click(function(event){ 110// event.stopPropagation(); 111var el = $(event.target); 112var gsfrm = $(el).closest('form'); 113if(el.attr('id') !='main-nav-search-link' && el.attr('role') != 'search' && gsfrm.attr('role') != 'search'){ 114$('.search-div').hide('slow'); 115} 116}); 117 118}); 119 120jQuery(document).ready(function($){ 121// Scroll (in pixels) after which the "To Top" link is shown 122var offset = 300, 123//Scroll (in pixels) after which the "back to top" link opacity is reduced 124offset_opacity = 1200, 125//Duration of the top scrolling animation (in ms) 126scroll_top_duration = 700, 127//Get the "To Top" link 128$back_to_top = $('.to-top'); 129 130//Visible or not "To Top" link 131$(window).scroll(function(){ 132( $(this).scrollTop() > offset ) ? $back_to_top.addClass('top-is-visible') : $back_to_top.removeClass('top-is-visible top-fade-out'); 133if( $(this).scrollTop() > offset_opacity ) { 134$back_to_top.addClass('top-fade-out'); 135} 136}); 137 138//Smoothy scroll to top 139 140$back_to_top.on('click', function(event){ 141event.preventDefault(); 142$('body,html').animate({ 143scrollTop: 0 , 144}, scroll_top_duration 145); 146}); 147 148});
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.