1jQuery(document).ready(function($){ 2 3 "use strict"; 4 5/*---------------------------------------*/ 6/* Sticky Header Nav */ 7/*---------------------------------------*/ 8 9 var nav = $('.site-header.sticky-nav'); 10 var body = $('body.has-sticky-nav'); 11 var wrapper = $('body.custom-background .site-wrapper'); 12 var headerheight = $(".site-header.sticky-nav").outerHeight() + 45; // Header height + bottom/top header margin 13 var logoheight = $(".site-header.sticky-nav .container").outerHeight() - 65; // 65 = primary nav height 14 var scrolltop = logoheight; 15 if ( $(".site-header .container .custom-logo").attr("data-height") > 65 ) { 16 $(".site-header .container .custom-logo").addClass("resize-on-sticky"); 17 } 18 19 if ($('.site-header.sticky-nav').hasClass('logo-below-nav') ) { 20 scrolltop = 0; 21 headerheight = headerheight - 30; // No top margin 22 } 23 24 if ($('.site-header.sticky-nav').hasClass('logo-split-menu') || $('.site-header.sticky-nav').hasClass('logo-left-menu') ) { 25 scrolltop = 15; 26 } 27 // Custom header variant 28 if ($('body').hasClass('has-custom-header') && ( $('.site-header').hasClass('logo-split-menu') || $('.site-header').hasClass('logo-left-menu') || $('.site-header').hasClass('logo-below-nav') ) ) { 29 scrolltop = 0; 30 } 31 if ($('body').hasClass('has-custom-header') && $('.site-header').hasClass('logo-below-nav') ) { 32 headerheight = headerheight + 15; // No top margin 33 } 34 if ($('body').hasClass('has-custom-header') && $('.site-header').hasClass('default') ) { 35 headerheight = headerheight - 15; // No top margin 36 } 37 if ($('body').hasClass('has-custom-header') && ( $('.site-header').hasClass('logo-split-menu') || $('.site-header').hasClass('logo-left-menu') ) ) { 38 headerheight = headerheight - 15; // No top margin 39 } 40 if ($('body').hasClass('has-custom-header') && $('body').hasClass('has-category-featured-background') && ( $('.site-header').hasClass('logo-split-menu') || $('.site-header').hasClass('logo-left-menu') ) ) { 41 headerheight = headerheight - 45; // No top margin 42 } 43 if ($('body').hasClass('has-custom-header') && $('body').hasClass('has-category-featured-background') && $('.site-header').hasClass('logo-below-nav') ) { 44 headerheight = headerheight; // No top margin 45 } 46 if ($('body').hasClass('has-custom-header') && $('body').hasClass('has-category-featured-background') && $('.site-header').hasClass('default') ) { 47 headerheight = headerheight - 30; 48 } 49 50 //var boxednavpadding = logoheight; // Logo height + bottom header margin 51 52 $(window).on('scroll', function () { 53 if ($(this).scrollTop() > scrolltop ) { 54 nav.addClass("fixed").css("margin-top", "-" + headerheight + "px" ); 55 body.addClass("body-fix").css("margin-top", "" + headerheight + "px" ); 56 $('.site-header:not(.logo-left-menu) .primary-menu-container .toggle.has-sticky-toggle-background').css("width", ""); 57 } else { 58 nav.removeClass("fixed").css("margin-top", "" ); 59 body.removeClass("body-fix").css("margin-top", "" ); 60 wrapper.css("padding-top", "" ); 61 } 62 }); 63 64/*---------------------------------------*/ 65/* Slide Menu Sidebar */ 66/*---------------------------------------*/ 67 68$(".toggle-menu span, .slide-menu .close-menu, .body-fade").on('click touch', function() { 69 $(".mobile-navigation").toggleClass("show"); 70 $("html").toggleClass("inactive"); 71 $(".body-fade").fadeToggle(400); 72 73 // Check for an active search form and close it 74 if($('.site-header .search-form').hasClass('show-search')) { 75 $(".site-header .search-form").slideToggle(300); 76 $(".site-header .search-form").toggleClass("show-search"); 77 // Toggle the close icon 78 $('li.search i.fa-search').toggle(); 79 $('li.search i.fa-close').toggle(); 80 } 81}); 82 83// Expand the parent/child menu 84$('.slide-menu ul.primary-nav-sidebar li.menu-item-has-children > span.expand').on('click touch', function(event) { 85 event.preventDefault(); 86 $(this).next('.sub-menu').slideToggle(200); 87 $(this).toggleClass("close"); 88}); 89 90/*---------------------------------------*/ 91/* Search drop down */ 92/*---------------------------------------*/ 93 94 $(".toggle-search span, .site-search i, .message-404 .toggle-search").on('click touch', function() { 95 $(".site-search").toggleClass("show-search"); 96 $(".site-search").fadeToggle(300); 97
98 // Focus the cursor on the search field when it's visible 99 $(".site-search.show-search .search-field").focus(); 100 101 // Remove focus when not visible 102 $('.site-search:not(.show-search) .search-field').blur(); 103 104 if($('.mobile-navigation').hasClass("show")) { 105 $(".mobile-navigation").toggleClass("show"); 106 $(".body-fade").fadeToggle(300); 107 } 108 109}); 110 111/*---------------------------------------*/ 112/* ESC key close of open toggle elements */ 113/*---------------------------------------*/ 114 115$(document).keyup(function(e) { 116 if (e.keyCode == 27) { // esc keycode 117 if($(".site-search").hasClass("show-search")) { 118 $(".site-search").fadeToggle(300); 119 $(".site-search").toggleClass("show-search"); 120 } 121 if($('.mobile-navigation').hasClass("show")) { 122 $(".mobile-navigation").toggleClass("show"); 123 $(".body-fade").fadeToggle(500); 124 } 125 } 126 }); 127 128/*---------------------------------------*/ 129/* smooth scroll to top */ 130/*---------------------------------------*/ 131$(".backtotop").on('click touch', function(event){ 132 event.preventDefault(); 133 $('body,html').animate({ 134 scrollTop: 0 , 135 }, 500 136 ); 137}); 138/*---------------------------------------*/ 139/* Back to Top Pop Up Link */ 140/*---------------------------------------*/ 141// browser window scroll (in pixels) after which the "back to top" link is shown 142 var offset = 1200, 143 //duration of the top scrolling animation (in ms) 144 scroll_top_duration = 100, 145 //grab the "back to top" link 146 $back_to_top = $('.goto-top'); 147 148 //hide or show the "back to top" link 149 $(window).on('scroll', function(){ 150 ( $(this).scrollTop() > offset ) ? $back_to_top.addClass("visible") : $back_to_top.removeClass("visible"); 151 }); 152/*---------------------------------------*/ 153/* smooth scroll anchor links */ 154/*---------------------------------------*/ 155$(document).on('click touch', 'a[href^="#comments"], a[href^="#reviews"]', function (event) { 156 event.preventDefault(); 157 // alert("boom"); 158 159 $('html, body').animate({ 160 scrollTop: $($.attr(this, 'href')).offset().top 161 }, 600); 162}); 163 164/*---------------------------------------*/ 165/* Toggle comments */ 166/*---------------------------------------*/ 167 168$('.toggle-comments').on('click touch', function() { 169 $('#comments').slideToggle(400); 170 $('#comments').toggleClass("open"); 171 $(this).toggleClass("close"); 172}); 173// Comments anchor link open and reset toggle comments 174$('.entry-comment-count a').on('click touch', function() { 175 if (! $('#comments').hasClass("open") ) { 176 $('#comments').slideToggle(400); 177 $('#comments').toggleClass("open"); 178 $('.toggle-comments').toggleClass("close"); 179 } 180}); 181$('.comments-pagination a.page-numbers').on('click touch', function() { 182 if ($('#comments').hasClass("close") ) { 183 $('#comments').slideToggle(400); 184 $('#comments').toggleClass("close"); 185 $('.toggle-comments').toggleClass("open"); 186 } 187}); 188 189/*---------------------------------------*/ 190/* Parallax iOs & Android Fix */ 191/*---------------------------------------*/ 192$(function(){ 193 194 if (navigator.userAgent.match(/(iPod|iPhone|iPad|Android)/)) { 195 $('.hero .flex-box.parallax-window').addClass('is-mobile-device'); 196 } 197 }); 198 199 200/*---------------------------------------*/ 201/* Split menu alignment */ 202/*---------------------------------------*/ 203 204var maxWidth = 0; // Initialize to zero 205var splitMenu = $('.split-menu'); // Cache to improve performance 206 207splitMenu.each(function() { // Loop over all the elements having class example 208 209 // Get the max width of elements and save in maxWidth variable 210 maxWidth = parseFloat($(this).outerWidth()) > maxWidth ? parseFloat($(this).outerWidth()) : maxWidth; 211}); 212 213$('.split-menu').css("width", "" + maxWidth + "px" ); // Set max height to all example elements 214 215/*---------------------------------------*/ 216/* Add width to toggle div to align menu */ 217/*---------------------------------------*/ 218 219 var maxWidth = 0; 220 var toggleDiv = $('.site-header:not(.logo-left-menu) .primary-menu-container .toggle'); 221 222 toggleDiv.each(function() { 223 224 maxWidth = parseFloat($(this).outerWidth()) > maxWidth ? parseFloat($(this).outerWidth()) + 15 : maxWidth; 225 226 }); 227 228 $('.site-header:not(.logo-left-menu) .primary-menu-container .toggle').css("width", "" + maxWidth + "px" ); 229 230 231 232}); 233 234 235
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.