1/** 2 * This file contains the main front-end JavaScript functionality for the theme. 3 * 4 * @author Pix & Hue 5 */ 6 7jQuery(document).ready(function($) { 8 9 /* -- Init Theme Scripts -- */ 10 emgrace_loading_gif(); 11 emgrace_pagination_icon(); 12 $('#emgrace-header #emgrace-searchform #searchsubmit').bind('click', emgrace_display_searchform_in_header); 13 $('.emgrace-header-mobile-search-close').bind('click', emgrace_hide_searchform_in_header); 14 15 /* -- Sticky Menu -- */ 16 $('.emgrace-nav-wrapper.emgrace-sticky-nav').emgrace_sticky({ 17 zIndex:9999, 18 }); 19 20 $('.emgrace-inline-center .emgrace-nav-wrapper.emgrace-sticky-nav').on('sticky-end', function() { 21 $('#emgrace-header .sticky-wrapper').css('height', 'auto'); 22 }); 23 24 /* -- Mobile Menu -- */ 25 $('.emgrace-nav-wrapper .menu').slicknav({ 26 prependTo:'#emgrace-menu-mobile', 27 label:'Show Menu', 28 allowParentLinks: true, 29 }); 30 31 /* -- Initialize Sliders -- */ 32 emgrace_initialize_bx_slider('#emgrace-featured-section .emgrace-bxslider', 'horizontal', 500, 4000, 0); 33 emgrace_initialize_bx_slider('#emgrace-content-container .instagram-pics', 'horizontal', 800, 4000, 3); 34 emgrace_initialize_bx_slider('#emgrace-content-container .zoom-instagram-widget__items', 'horizontal', 800, 4000, 3); 35 emgrace_initialize_bx_slider('.emgrace-post-img .emgrace-bxslider', 'horizontal', 500, 2500, 0); 36 37 /* -- Testimonials -- */ 38 if(!$('body').hasClass('elementor-editor-active')) { 39 emgrace_initialize_bx_slider('.emgrace-testimonials-section .elementor-widget-wrap', 'horizontal', 500, 4500, 0); 40 } 41 42 /* -- Responsive Adjustments for Elementor Page Templates (Services Section) -- */ 43 if($('.emgrace-overlap-text-section.emgrace-custom-services-page').length > 0 && $(window).width() < 768) { 44 emgrace_adjust_custom_services_text_section(); 45 } 46 $(window).resize(function() { 47 if($('.emgrace-overlap-text-section.emgrace-custom-services-page').length > 0 && $(window).width() < 768) { 48 emgrace_adjust_custom_services_text_section(); 49 } else if($('.emgrace-overlap-text-section.emgrace-custom-services-page').length > 0 && $(window).width() >= 768) { 50 emgrace_restore_custom_services_text_section(); 51 } 52 }); 53 54 /* -- Quotes Section -- */ 55 if($('.emgrace-custom-quote-section').length > 0 && !$('body').hasClass('elementor-editor-active')) { 56 emgrace_adjust_quote_section(); 57 } 58 $(window).resize(function() { 59 if($('.emgrace-custom-quote-section').length > 0 && !$('body').hasClass('elementor-editor-active')) { 60 emgrace_adjust_quote_section(); 61 } 62 }); 63 64 /* -- Elementor Hook - Trigger Animations in Edit Mode -- */ 65 if($('body').hasClass('elementor-editor-active')) { 66 elementorFrontend.hooks.addAction( 'frontend/element_ready/widget', function( $scope ) { 67 emgrace_initialize_bx_slider('#emgrace-content-container .instagram-pics', 'horizontal', 800, 4000, 3); 68 emgrace_initialize_bx_slider('#emgrace-content-container .zoom-instagram-widget__items', 'horizontal', 800, 4000, 3); 69 emgrace_initialize_bx_slider('.emgrace-post-img .emgrace-bxslider', 'horizontal', 500, 2500, 0); 70 }); 71 } 72 73 /* -- Initialize Fit Vids -- */ 74 $(".emgrace-container").fitVids(); 75 76}); 77 78var $j = jQuery.noConflict(); 79 80/************************************* 81 * Loading Gif 82**************************************/ 83function emgrace_loading_gif() { 84 "use strict"; 85 86 $j(window).load(function() { 87 $j(".emgrace-loader").fadeOut(400); 88 }); 89} 90 91/************************************* 92 * Pagination Arrow Icon 93**************************************/ 94function emgrace_pagination_icon() { 95 "use strict"; 96 97 if($j('.emgrace-pagination').length > 0) { 98 if($j('.emgrace-older').length > 0 && !$j('.emgrace-older').has('span').length > 0) { 99 $j('.emgrace-older').find('img').hide(); 100 } 101 if ($j('.emgrace-newer').length > 0 && !$j('.emgrace-newer').has('span').length > 0) { 102 $j('.emgrace-newer').find('img').hide(); 103 } 104 } 105} 106 107/************************************* 108 * Initialize the BX Slider 109**************************************/ 110function emgrace_initialize_bx_slider(className, mode, speed, pause, slideMargin) { 111 "use strict"; 112 113 var one_slide = $j(className).children().length < 2; 114 var pagers = (!one_slide); 115 var controls = false;
116 var next_text = '<img src="' + emgrace_default_icon + '/images/icons/emgrace_right_arrow.png' + '">'; 117 var previous_text = '<img src="' + emgrace_default_icon + '/images/icons/emgrace_left_arrow.png' + '">'; 118 119 if(className == '.emgrace-testimonials-section .elementor-widget-wrap') { 120 pagers = false 121 controls = (!one_slide); 122 } 123 124 $j(className).bxSlider({ 125 auto: (!one_slide), 126 controls: controls, 127 touchEnabled: (!one_slide), 128 mode: mode, 129 pager: pagers, 130 slideMargin: slideMargin, 131 speed: speed, 132 pause: pause, 133 nextText: next_text, 134 prevText: previous_text, 135 }); 136} 137 138/************************************* 139 * Show Mobile Searchform in Header 140**************************************/ 141function emgrace_display_searchform_in_header(event) { 142 "use strict"; 143 144 if($j(window).width() < 1125) { 145 146 //Show the Mobile Searchform + Make it Searchable 147 event.preventDefault(); 148 $j(this).parent().parent().addClass('emgrace-mobile-header-searchform'); 149 $j(this).prev().fadeIn(); 150 $j(this).siblings('.emgrace-header-mobile-search-close').fadeIn(); 151 $j(this).unbind('click'); 152 } 153} 154 155/************************************* 156 * Hide Mobile Searchform in Header 157**************************************/ 158function emgrace_hide_searchform_in_header() { 159 "use strict"; 160 161 if($j(window).width() < 1125) { 162 163 $j(this).siblings('#searchsubmit').bind('click', emgrace_display_searchform_in_header); 164 $j(this).next().next().hide(); 165 $j(this).hide(); 166 $j(this).parent().parent().removeClass('emgrace-mobile-header-searchform'); 167 } 168} 169 170 171/***************************************************** 172 * Adjust Custom Services Text Section at Mobile 173*******************************************************/ 174function emgrace_adjust_custom_services_text_section() { 175 "use strict"; 176 177 var text_column_height = $j('.emgrace-text-column.emgrace-custom-page-three .elementor-widget-wrap').outerHeight(); 178 var padding_bottom_value = 155 + (text_column_height - 325); 179 var bottom_value = -97; 180 if(text_column_height != 325) { 181 bottom_value = -(text_column_height - 325) - 67; 182 if(text_column_height < 325) { 183 bottom_value = bottom_value - 35; 184 } 185 } 186 187 if($j(window).width() >= 501 && $j(window).width() < 651) { 188 padding_bottom_value = 310 + (text_column_height - 323); 189 if(text_column_height != 323) { 190 bottom_value = -(text_column_height - 323) - 211; 191 if(text_column_height < 325) { 192 bottom_value = bottom_value - 30; 193 } 194 } else { 195 bottom_value = -216; 196 } 197 } else if($j(window).width() < 501) { 198 padding_bottom_value = 385 + (text_column_height - 316); 199 if(text_column_height != 316) { 200 bottom_value = -(text_column_height - 316) - 285; 201 } else { 202 bottom_value = -290; 203 } 204 } 205 206 if($j('.emgrace-overlap-text-section').hasClass('emgrace-custom-five')) { 207 padding_bottom_value = padding_bottom_value - 30; 208 if($j(window).width() >= 501 && $j(window).width() < 651) { 209 padding_bottom_value = padding_bottom_value - 15; 210 } else if($j(window).width() < 501) { 211 padding_bottom_value = padding_bottom_value - 20; 212 } 213 } 214 215 $j('.emgrace-overlap-text-section.emgrace-custom-services-page').css('cssText', 'padding-bottom: ' + (padding_bottom_value) + 'px !important'); 216 $j('.emgrace-overlap-text-section .emgrace-text-column.emgrace-custom-page-three').css('bottom', (bottom_value)); 217} 218 219/***************************************************** 220 * Restore Custom Services Text Section above Mobile 221*******************************************************/ 222function emgrace_restore_custom_services_text_section() { 223 "use strict"; 224 225 var padding_bottom_value = 20; 226 227 if($j(window).width() > 950 || $j('.emgrace-overlap-text-section').hasClass('emgrace-custom-five')) { 228 padding_bottom_value = 0; 229 } 230 231 $j('.emgrace-overlap-text-section.emgrace-custom-services-page').css('cssText', 'padding-bottom: ' + padding_bottom_value + 'px !important'); 232 $j('.emgrace-overlap-text-section .emgrace-text-column.emgrace-custom-page-three').css('bottom', 'auto'); 233} 234 235/***************************************************** 236 * Adjust Quote Section at Mobile 237*******************************************************/ 238function emgrace_adjust_quote_section() { 239 "use strict"; 240 241 var title_height = $j('.emgrace-custom-quote-section .emgrace-standard-elementor-headline .elementor-heading-title').height(); 242 var margin_top_value = 103; 243 var margin_adjustment = title_height - 25; 244 245 if($j(window).width() < 951) { 246 margin_top_value = 93; 247 margin_adjustment = title_height - 23; 248 } 249 250 $j('.emgrace-quotation-marks').css('cssText', 'margin-top: ' + (-margin_top_value - margin_adjustment) + 'px !important') 251}
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.