PageSourceSearch

https://www.gotinfluenceinc.com/wp-content/themes/Divi/js/custom.js?ver=4.4.3

js gotinfluenceinc.com collected 2026-10-08 02:13:52 UTC 77,420 bytes, 1,791 lines download raw bytes

vendor: 3,613 bytes, lines 1-88
1/******/ (function(modules) { // webpackBootstrap
2/******/ 	// The module cache
3/******/ 	var installedModules = {};
4/******/
5/******/ 	// The require function
6/******/ 	function __webpack_require__(moduleId) {
7/******/
8/******/ 		// Check if module is in cache
9/******/ 		if(installedModules[moduleId]) {
10/******/ 			return installedModules[moduleId].exports;
11/******/ 		}
12/******/ 		// Create a new module (and put it into the cache)
13/******/ 		var module = installedModules[moduleId] = {
14/******/ 			i: moduleId,
15/******/ 			l: false,
16/******/ 			exports: {}
17/******/ 		};
18/******/
19/******/ 		// Execute the module function
20/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
21/******/
22/******/ 		// Flag the module as loaded
23/******/ 		module.l = true;
24/******/
25/******/ 		// Return the exports of the module
26/******/ 		return module.exports;
27/******/ 	}
28/******/
29/******/
30/******/ 	// expose the modules object (__webpack_modules__)
31/******/ 	__webpack_require__.m = modules;
32/******/
33/******/ 	// expose the module cache
34/******/ 	__webpack_require__.c = installedModules;
35/******/
36/******/ 	// define getter function for harmony exports
37/******/ 	__webpack_require__.d = function(exports, name, getter) {
38/******/ 		if(!__webpack_require__.o(exports, name)) {
39/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
40/******/ 		}
41/******/ 	};
42/******/
43/******/ 	// define __esModule on exports
44/******/ 	__webpack_require__.r = function(exports) {
45/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
46/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
47/******/ 		}
48/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
49/******/ 	};
50/******/
51/******/ 	// create a fake namespace object
52/******/ 	// mode & 1: value is a module id, require it
53/******/ 	// mode & 2: merge all properties of value into the ns
54/******/ 	// mode & 4: return value when already ns object
55/******/ 	// mode & 8|1: behave like require
56/******/ 	__webpack_require__.t = function(value, mode) {
57/******/ 		if(mode & 1) value = __webpack_require__(value);
58/******/ 		if(mode & 8) return value;
59/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
60/******/ 		var ns = Object.create(null);
61/******/ 		__webpack_require__.r(ns);
62/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
63/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
64/******/ 		return ns;
65/******/ 	};
66/******/
67/******/ 	// getDefaultExport function for compatibility with non-harmony modules
68/******/ 	__webpack_require__.n = function(module) {
69/******/ 		var getter = module && module.__esModule ?
70/******/ 			function getDefault() { return module['default']; } :
71/******/ 			function getModuleExports() { return module; };
72/******/ 		__webpack_require__.d(getter, 'a', getter);
73/******/ 		return getter;
74/******/ 	};
75/******/
76/******/ 	// Object.prototype.hasOwnProperty.call
77/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
78/******/
79/******/ 	// __webpack_public_path__
80/******/ 	__webpack_require__.p = "";
81/******/
82/******/
83/******/ 	// Load entry module and return exports
84/******/ 	return __webpack_require__(__webpack_require__.s = "./js/src/custom.js");
85/******/ })
86/************************************************************************/
87/******/ ({
88
89/***/ "./js/src/custom.js":
90/*!**************************!*\
91  !*** ./js/src/custom.js ***!
92  \**************************/
93/*! no static exports found */
94/***/ (function(module, exports) {
95
96function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
97
98// Check whether current page is inside (visual) builder or not
99var isBuilder = 'object' === _typeof(window.ET_Builder);
100/*! ET custom.js */
101
102
103(function ($) {
104  window.et_calculating_scroll_position = false;
105  window.et_side_nav_links_initialized = false;
106  var top_window = isBuilder ? ET_Builder.Frames.top : window;
107
108  function et_get_first_section() {
109    return $('.et-l:not(.et-l--footer) .et_pb_section:visible:first');
110  }
111
112  function et_get_first_module() {
113    return $('.et-l .et_pb_module:visible:first');
114  }
115
116  var $et_pb_post_fullwidth = $('.single.et_pb_pagebuilder_layout.et_full_width_page'),
117      et_is_mobile_device = navigator.userAgent.match(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/),
118      et_is_ipad = navigator.userAgent.match(/iPad/),
119      $et_container = $('.container'),
120      et_container_width = $et_container.width(),
121      et_is_fixed_nav = $('body').hasClass('et_fixed_nav') || $('body').hasClass('et_vertical_fixed'),
122      et_is_vertical_fixed_nav = $('body').hasClass('et_vertical_fixed'),
123      et_is_rtl = $('body').hasClass('rtl'),
124      et_hide_nav = $('body').hasClass('et_hide_nav'),
125      et_header_style_left = $('body').hasClass('et_header_style_left'),
126      $top_header = $('#top-header'),
127      $main_header = $('#main-header'),
128      $main_container_wrapper = $('#page-container'),
129      $et_main_content_first_row = $('#main-content .container:first-child'),
130      $et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),
131      $et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find('h1.entry-title'),
132      $et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),
133      $et_single_post = $('body.single'),
134      $et_window = $(window),
135      etRecalculateOffset = false,
136      et_header_height = 0,
137      et_header_modifier,
138      et_header_offset,
139      et_primary_header_top,
140      $et_header_style_split = $('.et_header_style_split'),
141      $et_top_navigation = $('#et-top-navigation'),
142      $logo = $('#logo'),
143      $et_pb_first_row = et_get_first_section(),
144      et_is_touch_device = 'ontouchstart' in window || navigator.maxTouchPoints,
145      $et_top_cart = $('#et-secondary-menu a.et-cart-info'); // Modification of underscore's _.debounce()
146  // Underscore.js 1.8.3
147  // http://underscorejs.org
148  // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
149  // Underscore may be freely distributed under the MIT license.
150
151  function et_debounce(func, wait, immediate) {
152    var timeout, args, context, timestamp, result;
153    var now = Date.now || new Date().getTime();
154
155    var later = function later() {
156      var last = now - timestamp;
157
158      if (last < wait && last >= 0) {
159        timeout = setTimeout(later, wait - last);
160      } else {
161        timeout = null;
162
163        if (!immediate) {
164          result = func.apply(context, args);
165          if (!timeout) context = args = null;
166        }
167      }
168    };
169
170    return function () {
171      context = this;
172      args = arguments;
173      timestamp = now;
174      var callNow = immediate && !timeout;
175      if (!timeout) timeout = setTimeout(later, wait);
176
177      if (callNow) {
178        result = func.apply(context, args);
179        context = args = null;
180      }
181
182      return result;
183    };
184  }
185
186  ;
187
188  function et_preload_image(src, callback) {
189    var img = new Image();
190    img.onLoad = callback;
191    img.onload = callback;
192    img.src = src;
193  } // We need to check first to see if we are on a woocommerce single product.
194
195
196  if ($(".woocommerce .woocommerce-product-gallery").length > 0) {
197    // get the gallery container.
198    var gal = $(".woocommerce-product-gallery")[0]; // let's replace the data attribute since Salvatorre reconfigures
199    // data-columns on the resize event.
200
201    var newstr = gal.outerHTML.replace('data-columns', 'data-cols'); // finally we re-insert.
202
203    gal.outerHTML = newstr;
204  } // update the cart item on the secondary menu.
205
206
207  if ($et_top_cart.length > 0 && $('.shop_table.cart').length > 0) {
208    $(document.body).on('updated_wc_div', function () {
209      var new_total = 0;
210      var new_text;
211      $('.shop_table.cart').find('.product-quantity input').each(function () {
212        new_total = new_total + parseInt($(this).val());
213      });
214
215      if (new_total === 1) {
216        new_text = DIVI.item_count;
217      } else {
218        new_text = DIVI.items_count;
219      }
220
221      new_text = new_text.replace('%d', new_total);
222      $et_top_cart.find('span').text(new_text);
223    });
224  }
225
226  $(document).ready(function () {
227    var $et_top_menu = $('ul.nav, ul.menu'),
228        $et_search_icon = $('#et_search_icon'),
229        et_parent_menu_longpress_limit = 300,
230        et_parent_menu_longpress_start,
231        et_parent_menu_click = true,
232        is_customize_preview = $('body').hasClass('et_is_customize_preview');
233    window.et_pb_init_nav_menu($et_top_menu);
234
235    function et_header_menu_split() {
236      var $logo_container = $('#main-header > .container > .logo_container'),
237          $logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),
238          et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),
239          et_top_navigation_li_break_index = Math.round(et_top_navigation_li_size / 2) - 1,
240          window_width = window.innerWidth || $et_window.width();
241
242      if (window_width > 980 && $logo_container.length && $('body').hasClass('et_header_style_split')) {
243        $('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth(' + et_top_navigation_li_break_index + ')'));
244        $logo_container.appendTo($et_top_navigation.find('.centered-inline-logo-wrap'));
245      }
246
247      if (window_width <= 980 && $logo_container_splitted.length) {
248        $logo_container_splitted.prependTo('#main-header > .container');
249        $('#main-header .centered-inline-logo-wrap').remove();
250      }
251    }
252
253    function et_set_right_vertical_menu() {
254      var $body = $('body');
255
256      if ($body.hasClass('et_boxed_layout') && $body.hasClass('et_vertical_fixed') && $body.hasClass('et_vertical_right')) {
257        var header_offset = parseFloat($('#page-container').css('margin-right'));
258        header_offset += parseFloat($('#et-main-area').css('margin-right')) - 225;
259        header_offset = 0 > header_offset ? 0 : header_offset;
260        $('#main-header').addClass('et_vertical_menu_set').css({
261          'left': '',
262          'right': header_offset
263        });
264      }
265    }
266
267    if ($et_header_style_split.length && !window.et_is_vertical_nav || is_customize_preview) {
268      et_header_menu_split();
269      $(window).resize(function () {
270        et_header_menu_split();
271      });
272    }
273
274    if (window.et_is_vertical_nav) {
275      if ($('#main-header').height() < $('#et-top-navigation').height()) {
276        $('#main-header').height($('#et-top-navigation').height() + $('#logo').height() + 100);
277      }
278
279      et_set_right_vertical_menu();
280    }
281
282    window.et_calculate_header_values = function () {
283      var $top_header = $('#top-header'),
284          secondary_nav_height = $top_header.length && $top_header.is(':visible') ? parseInt($top_header.innerHeight()) : 0,
285          admin_bar_height = $('#wpadminbar').length ? parseInt($('#wpadminbar').innerHeight()) : 0,
286          $slide_menu_container = $('.et_header_style_slide .et_slide_in_menu_container'),
287          is_rtl = $('body').hasClass('rtl');
288      et_header_height = parseInt($('#main-header').innerHeight()) + secondary_nav_height;
289      et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56;
290      et_header_offset = et_header_modifier + admin_bar_height;
291      et_primary_header_top = secondary_nav_height + admin_bar_height;
292
293      if ($slide_menu_container.length && !$('body').hasClass('et_pb_slide_menu_active')) {
294        if (is_rtl) {
295          $slide_menu_container.css({
296            left: '-' + parseInt($slide_menu_container.innerWidth()) + 'px',
297            'display': 'none'
298          });
299        } else {
300          $slide_menu_container.css({
301            right: '-' + parseInt($slide_menu_container.innerWidth()) + 'px',
302            'display': 'none'
303          });
304        }
305
306        if ($('body').hasClass('et_boxed_layout')) {
307          if (is_rtl) {
308            var page_container_margin = $main_container_wrapper.css('margin-right');
309            $main_header.css({
310              right: page_container_margin
311            });
312          } else {
313            var page_container_margin = $main_container_wrapper.css('margin-left');
314            $main_header.css({
315              left: page_container_margin
316            });
317          }
318        }
319      }
320    };
321
322    var $comment_form = $('#commentform');
323    et_pb_form_placeholders_init($comment_form);
324    $comment_form.submit(function () {
325      et_pb_remove_placeholder_text($comment_form);
326    });
327    et_duplicate_menu($('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu');
328    et_duplicate_menu('', $('.et_pb_fullscreen_nav_container'), 'mobile_menu_slide', 'et_mobile_menu', 'no_click_event'); // Handle `Disable top tier dropdown menu links` Theme Option.
329
330    if ($('ul.et_disable_top_tier').length) {
331      var $disbaled_top_tier_links = $("ul.et_disable_top_tier > li > ul").prev('a');
332      $disbaled_top_tier_links.attr('href', '#');
333      $disbaled_top_tier_links.on('click', function (e) {
334        e.preventDefault();
335      }); // Handle top tier links in cloned mobile menu
336
337      var $disbaled_top_tier_links_mobile = $("ul#mobile_menu > li > ul").prev('a');
338      $disbaled_top_tier_links_mobile.attr('href', '#');
339      $disbaled_top_tier_links_mobile.on('click', function (e) {
340        e.preventDefault();
341      });
342    }
343
344    if ($('#et-secondary-nav').length) {
345      $('#et-top-navigation #mobile_menu').append($('#et-secondary-nav').clone().html());
346    } // adding arrows for the slide/fullscreen menus
347
348
349    if ($('.et_slide_in_menu_container').length) {
350      var $item_with_sub = $('.et_slide_in_menu_container').find('.menu-item-has-children > a'); // add arrows for each menu item which has submenu
351
352      if ($item_with_sub.length) {
353        $item_with_sub.append('<span class="et_mobile_menu_arrow"></span>');
354      }
355    }
356
357    function et_change_primary_nav_position(delay) {
358      setTimeout(function () {
359        var $body = $('body'),
360            $wpadminbar = isBuilder ? top_window.jQuery('#wpadminbar') : $('#wpadminbar'),
361            $top_header = $('#top-header'),
362            et_primary_header_top = 0;
363
364        if ($wpadminbar.length) {
365          var adminbarHeight = $wpadminbar.innerHeight(); // Adjust admin bar height for builder's preview mode zoom since admin bar is rendered on top window
366
367          if (isBuilder && top_window.jQuery('html').is('.et-fb-preview--zoom:not(.et-fb-preview--desktop)')) {
368            adminbarHeight = adminbarHeight * 2;
369          }
370
371          et_primary_header_top += adminbarHeight;
372        }
373
374        if ($top_header.length && $top_header.is(':visible')) {
375          et_primary_header_top += $top_header.innerHeight();
376        }
377
378        var isFixedNav = $body.hasClass('et_fixed_nav');
379        var isAbsolutePrimaryNav = !isFixedNav && $body.hasClass('et_transparent_nav') && $body.hasClass('et_secondary_nav_enabled');
380
381        if (!window.et_is_vertical_nav && (isFixedNav || isAbsolutePrimaryNav)) {
382          $('#main-header').css('top', et_primary_header_top);
383        }
384      }, delay);
385    }
386
387    window.et_change_primary_nav_position = et_change_primary_nav_position;
388
389    function et_hide_nav_transform() {
390      var $body = $('body'),
391          $body_height = $(document).height(),
392          $viewport_height = $(window).height() + et_header_height + 200; // Do nothing when Vertical Navigation is Enabled
393
394      if ($body.hasClass('et_vertical_nav')) {
395        return;
396      }
397
398      if ($body.hasClass('et_hide_nav') || $body.hasClass('et_hide_nav_disabled') && $body.hasClass('et_fixed_nav')) {
399        if ($body_height > $viewport_height) {
400          if ($body.hasClass('et_hide_nav_disabled')) {
401            $body.addClass('et_hide_nav');
402            $body.removeClass('et_hide_nav_disabled');
403          }
404
405          $('#main-header').css('transform', 'translateY(-' + et_header_height + 'px)');
406          $('#top-header').css('transform', 'translateY(-' + et_header_height + 'px)');
407        } else {
408          $('#main-header').css({
409            'transform': 'translateY(0)',
410            'opacity': '1'
411          });
412          $('#top-header').css({
413            'transform': 'translateY(0)',
414            'opacity': '1'
415          });
416          $body.removeClass('et_hide_nav');
417          $body.addClass('et_hide_nav_disabled');
418        } // Run fix page container again, needed when body height is not tall enough and
419        // adjustment has been aded
420
421
422        et_fix_page_container_position();
423      }
424    } // Saving current styling for the next resize cycle
425
426
427    function et_save_initial_page_container_style($selector, property) {
428      var styling = {};
429      styling[property] = $selector.css(property);
430      $selector.attr({
431        'data-fix-page-container': 'on'
432      }).data({
433        'fix_page_container_style': styling
434      });
435    }
436
437    function et_page_load_scroll_to_anchor() {
438      var location_hash = window.et_location_hash.replace(/(\|)/g, "\\$1");
439
440      if ($(location_hash).length === 0) {
441        return;
442      }
443
444      var $map_container = $(location_hash + ' .et_pb_map_container');
445      var $map = $map_container.children('.et_pb_map');
446      var $target = $(location_hash); // Make the target element visible again
447
448      if ('undefined' !== typeof window.et_location_hash_style) {
449        $target.css('display', window.et_location_hash_style);
450      }
451
452      var distance = 'undefined' !== typeof $target.offset().top ? $target.offset().top : 0;
453      var speed = distance > 4000 ? 1600 : 800;
454
455      if ($map_container.length) {
456        google.maps.event.trigger($map[0], 'resize');
457      } // Allow the header sizing functions enough time to finish before scrolling the page
458
459
460      setTimeout(function () {
461        et_pb_smooth_scroll($target, false, speed, 'swing'); // During the page scroll animation, the header's height might change.
462        // Do the scroll animation again to ensure its accuracy.
463
464        setTimeout(function () {
465          et_pb_smooth_scroll($target, false, 150, 'linear');
466        }, speed + 25);
467      }, 700);
468    } // Retrieving padding/margin value based on formatted saved padding/margin strings
469
470
471    function et_get_saved_padding_margin_value(saved_value, order) {
472      if (typeof saved_value === 'undefined') {
473        return false;
474      }
475
476      var values = saved_value.split('|');
477      return typeof values[order] !== 'undefined' ? values[order] : false;
478    }
479
480    function et_fix_page_container_position() {
481      var et_window_width = parseInt($et_window.width()),
482          $top_header = $('#top-header'),
483          $et_pb_first_row = et_get_first_section(),
484          secondary_nav_height = $top_header.length && $top_header.is(':visible') ? parseInt($top_header.innerHeight()) : 0,
485          main_header_fixed_height = 0,
486          header_height,
487          et_pb_first_row_padding_top;
488      var $mainHeaderClone = $main_header.clone().addClass('et-disabled-animations main-header-clone').css({
489        opacity: 0,
490        position: 'fixed',
491        top: 'auto',
492        right: 0,
493        bottom: 0,
494        left: 0
495      }).appendTo($('body')); // Replace previous resize cycle's adjustment
496
497      if (!$('body').hasClass('et-bfb')) {
498        $('*[data-fix-page-container="on"]').each(function () {
499          var $adjusted_element = $(this),
500              styling = $adjusted_element.data();
501
502          if (styling && styling.fix_page_container_style) {
503            // Reapply previous styling
504            $adjusted_element.css(styling.fix_page_container_style);
505          }
506        });
507      } // Set data-height-onload for header if the page is loaded on large screen
508      // If the page is loaded from small screen, rely on data-height-onload printed on the markup,
509      // prevent window resizing issue from small to large
510      // ignore data-height-loaded in VB to make sure it calculated correctly.
511
512
513      if (et_window_width > 980 && (!$main_header.attr('data-height-loaded') || $('body').is('.et-fb'))) {
514        var mainHeaderHeight = 0;
515
516        if ($main_header.hasClass('et-fixed-header')) {
517          $mainHeaderClone.removeClass('et-fixed-header');
518          mainHeaderHeight = $mainHeaderClone.height();
519          $mainHeaderClone.addClass('et-fixed-header');
520        } else {
521          mainHeaderHeight = $main_header.height();
522        }
523
524        $main_header.attr({
525          'data-height-onload': parseInt(mainHeaderHeight),
526          'data-height-loaded': true
527        });
528      } // Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)
529
530
531      if (et_window_width <= 980) {
532        header_height = parseInt($main_header.innerHeight()) + secondary_nav_height - ($('body').hasClass('et-fb') ? 0 : 1); // If transparent is detected, #main-content .container's padding-top needs to be added to header_height
533        // And NOT a pagebuilder page
534
535        if (window.et_is_transparent_nav && !$et_pb_first_row.length) {
536          header_height += 58;
537        }
538      } else {
539        // Get header height from header attribute
540        header_height = parseInt($main_header.attr('data-height-onload')) + secondary_nav_height; // Non page builder page needs to be added by #main-content .container's fixed height
541
542        if (window.et_is_transparent_nav && !window.et_is_vertical_nav && $et_main_content_first_row.length) {
543          header_height += 58;
544        } // Calculate fixed header height by cloning, emulating, and calculating its height
545
546
547        main_header_fixed_height = $mainHeaderClone.height();
548      } // Saved fixed main header height calculation
549
550
551      $main_header.attr({
552        'data-fixed-height-onload': main_header_fixed_height
553      });
554      var $wooCommerceNotice = $('.et_fixed_nav.et_transparent_nav.et-db.et_full_width_page #left-area > .woocommerce-notices-wrapper');
555
556      if ($wooCommerceNotice.length > 0 && 'yes' !== $wooCommerceNotice.attr('data-position-set')) {
557        var wooNoticeMargin = main_header_fixed_height;
558
559        if (0 === wooNoticeMargin && $main_header.attr('data-height-onload')) {
560          wooNoticeMargin = $main_header.attr('data-height-onload');
561        }
562
563        $wooCommerceNotice.css('marginTop', parseFloat(wooNoticeMargin));
564        $wooCommerceNotice.animate({
565          'opacity': '1'
566        });
567        $wooCommerceNotice.attr('data-position-set', 'yes');
568      } // Specific adjustment required for transparent nav + not vertical nav + (not hidden n
568av
569      // OR hidden nav but document height is shorter than "viewport" height)
570      // NOTES:
571      // 1. hidden nav: nav is initially hidden then appears as the window is scrolled)
572      // 2. in hidden nav, nav is displayed as window is scrolled. If document height is
573      //    shorter than viewport, vertical scroll doesn't exist and nav is directly rendered.
574      //    Thus, transparent nav adjustment need to be applied if body is shorter than window
575      // 3. Hidden nav only works on desktop breakpoint. Nav is always displayed on tablet
576      //    and smaller breakpoints
577      // 4. "viewport" height calculation needs to be identical with viewport calculation used
578      //    at `et_hide_nav_transform()` to make sure that when nav is displayed due to short
579      //    document height, the padding gets added
580
581
582      var bodyHeight = $(document).height();
583      var viewportHeight = $(window).height() + et_header_height + 200;
584      var isBodyShorterThanViewport = viewportHeight > bodyHeight;
585      var isDesktop = parseInt($(window).width()) > 980;
586      var isHideNavDesktop = isDesktop && et_hide_nav;
587
588      if (window.et_is_transparent_nav && !window.et_is_vertical_nav && (!isHideNavDesktop || isBodyShorterThanViewport)) {
589        if (!$('body').hasClass('et-bfb')) {
590          // Add class for first row for custom section padding purpose
591          $et_pb_first_row.addClass('et_pb_section_first');
592        } // List of conditionals
593
594
595        var is_pb = $et_pb_first_row.length,
596            is_post_pb = is_pb && $et_single_post.length,
597            is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,
598            is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,
599            is_post_with_tb_body = is_post_pb && $('.et-l--body').length,
600            is_pb_fullwidth_section_first = $et_pb_first_row.is('.et_pb_fullwidth_section'),
601            is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length,
602            isProject = $('body').hasClass('single-project');
603
604        if (!is_post_with_tb_body && is_post_pb && !(is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first) && !isProject) {
605          /* Desktop / Mobile + Single Post */
606
607          /*
608           * EXCEPT for fullwidth layout + fullwidth section ( at the first row ).
609           * It is basically the same as page + fullwidth section with few quirk.
610           * Instead of duplicating the conditional for each module, it'll be simpler to negate
611           * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first
612           */
613          // Remove main content's inline padding to styling to prevent looping padding-top calculation
614          $et_main_content_first_row.css({
615            'paddingTop': ''
616          });
617
618          if (et_window_width < 980) {
619            header_height += 40;
620          }
621
622          if (is_pb_fullwidth_section_first) {
623            // If the first section is fullwidth, restore the padding-top modified area at first section
624            $et_pb_first_row.css({
625              'paddingTop': '0'
626            });
627          }
628
629          if (is_post_pb_full_layout_has_title) {
630            // Add header height to post meta wrapper as padding top
631            $et_main_content_first_row_meta_wrapper.css({
632              'paddingTop': header_height
633            });
634          } else if (is_post_pb_full_layout_no_title) {
635            // Save current styling for the next resize cycle
636            et_save_initial_page_container_style($et_pb_first_row, 'paddingTop'); // Reset any inline padding-top.
637
638            $et_pb_first_row.css({
639              paddingTop: ''
640            });
641            $et_pb_first_row.css({
642              // Ignore the extra 58px added to header height previously.
643              'paddingTop': 'calc(' + (header_height - 58) + 'px + ' + $et_pb_first_row.css('paddingTop') + ')'
644            });
645          } else {
646            // Save current styling for the next resize cycle
647            et_save_initial_page_container_style($et_main_content_first_row, 'paddingTop'); // Add header height to first row content as padding top
648
649            $et_main_content_first_row.css({
650              'paddingTop': header_height
651            });
652          }
653        } else if (is_pb_fullwidth_section_first) {
654          /* Desktop / Mobile + Pagebuilder + Fullwidth Section */
655          var $et_pb_first_row_first_module = $et_pb_first_row.children('.et_pb_module:visible:first'); // Quirks: If this is post with fullwidth layout + no title + fullwidth section at first row,
656          // Remove the added height at line 2656
657
658          if (is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980) {
659            header_height = header_height - 58;
660          }
661
662          if ($et_pb_first_row_first_module.is('.et_pb_slider')) {
663            /* Desktop / Mobile + Pagebuilder + Fullwidth slider */
664            var $et_pb_first_row_first_module_slide_image = $et_pb_first_row_first_module.find('.et_pb_slide_image'),
665                $et_pb_first_row_first_module_slide = $et_pb_first_row_first_module.find('.et_pb_slide'),
666                $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module.find('.et_pb_slide .et_pb_container'),
667                et_pb_slide_image_margin_top = 0 - parseInt($et_pb_first_row_first_module_slide_image.height()) / 2,
668                et_pb_slide_container_height = 0,
669                $et_pb_first_row_first_module_slider_arrow = $et_pb_first_row_first_module.find('.et-pb-slider-arrows a'),
670                et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height(); // Save current styling for the next resize cycle
671
672            et_save_initial_page_container_style($et_pb_first_row_first_module_slide, 'paddingTop'); // Adding padding top to each slide so the transparency become useful
673
674            $et_pb_first_row_first_module_slide.css({
675              'paddingTop': header_height
676            }); // delete container's min-height
677
678            $et_pb_first_row_first_module_slide_container.css({
679              'min-height': ''
680            }); // Save current styling for the next resize cycle
681
682            et_save_initial_page_container_style($et_pb_first_row_first_module_slide_image, 'marginTop'); // Adjusting slider's image, considering additional top padding of slideshow
683
684            $et_pb_first_row_first_module_slide_image.css({
685              'marginTop': et_pb_slide_image_margin_top
686            }); // Save current styling for the next resize cycle
687
688            et_save_initial_page_container_style($et_pb_first_row_first_module_slider_arrow, 'marginTop'); // Adjusting slider's arrow, considering additional top padding of slideshow
689
690            $et_pb_first_row_first_module_slider_arrow.css({
691              'marginTop': header_height / 2 - et_pb_first_row_slider_arrow_height / 2
692            }); // Looping the slide and get the highest height of slide
693
694            var et_pb_first_row_slide_container_height_new = 0;
695            $et_pb_first_row_first_module.find('.et_pb_slide').each(function () {
696              var $et_pb_first_row_first_module_slide_item = $(this),
697                  $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module_slide_item.find('.et_pb_container'); // Make sure that the slide is visible to calculate correct height
698
699              $et_pb_first_row_first_module_slide_item.show(); // Remove existing inline css to make sure that it calculates the height
700
701              $et_pb_first_row_first_module_slide_container.css({
702                'min-height': ''
703              });
704              var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHe
704ight();
705
706              if (et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height) {
707                et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height;
708              } // Hide the slide back if it isn't active slide
709
710
711              if ($et_pb_first_row_first_module_slide_item.is(':not(".et-pb-active-slide")')) {
712                $et_pb_first_row_first_module_slide_item.hide();
713              }
714            }); // Save current styling for the next resize cycle
715
716            et_save_initial_page_container_style($et_pb_first_row_first_module_slide_container, 'min-height'); // Setting appropriate min-height, considering additional top padding of slideshow
717
718            $et_pb_first_row_first_module_slide_container.css({
719              'min-height': et_pb_first_row_slide_container_height_new
720            });
721          } else if ($et_pb_first_row_first_module.is('.et_pb_fullwidth_header')) {
722            /* Desktop / Mobile + Pagebuilder + Fullwidth header */
723            // Remove existing inline stylesheet to prevent looping padding
724            $et_pb_first_row_first_module.removeAttr('style'); // Get paddingTop from stylesheet
725
726            var et_pb_first_row_first_module_fullwidth_header_padding_top = parseInt($et_pb_first_row_first_module.css('paddingTop')); // Save current styling for the next resize cycle
727
728            et_save_initial_page_container_style($et_pb_first_row_first_module, 'paddingTop'); // Implement stylesheet's padding-top + header_height
729
730            $et_pb_first_row_first_module.css({
731              'paddingTop': header_height + et_pb_first_row_first_module_fullwidth_header_padding_top
732            });
733          } else if ($et_pb_first_row_first_module.is('.et_pb_fullwidth_portfolio')) {
734            /* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */
735            // Save current styling for the next resize cycle
736            et_save_initial_page_container_style($et_pb_first_row_first_module, 'paddingTop');
737            $et_pb_first_row_first_module.css({
738              'paddingTop': header_height
739            });
740          } else if ($et_pb_first_row_first_module.is('.et_pb_map_container')) {
741            /* Desktop / Mobile + Pagebuilder + Fullwidth Map */
742            var $et_pb_first_row_map = $et_pb_first_row_first_module.find('.et_pb_map'); // Remove existing inline height to prevent looping height calculation
743
744            $et_pb_first_row_map.css({
745              'height': ''
746            }); // Implement map height + header height
747
748            $et_pb_first_row_first_module.find('.et_pb_map').css({
749              'height': header_height + parseInt($et_pb_first_row_map.css('height'))
750            }); // Adding specific class to mark the map as first row section element
751
752            $et_pb_first_row_first_module.addClass('et_beneath_transparent_nav');
753          } else if ($et_pb_first_row_first_module.is('.et_pb_menu') || $et_pb_first_row_first_module.is('.et_pb_fullwidth_menu')) {
754            /* Desktop / Mobile + Pagebuilder + Fullwidth Menu */
755            // Save current styling for the next resize cycle
756            et_save_initial_page_container_style($et_pb_first_row_first_module, 'marginTop');
757            $et_pb_first_row_first_module.css({
758              'marginTop': header_height
759            });
760          } else if ($et_pb_first_row_first_module.is('.et_pb_fullwidth_code')) {
761            /* Desktop / Mobile + Pagebuilder + Fullwidth code */
762            var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module;
763            $et_pb_first_row_first_module_code.css({
764              'paddingTop': ''
765            });
766            var et_pb_first_row_first_module_code_padding_top = parseInt($et_pb_first_row_first_module_code.css('paddingTop')); // Save current styling for the next resize cycle
767
768            et_save_initial_page_container_style($et_pb_first_row_first_module_code, 'paddingTop');
769            $et_pb_first_row_first_module_code.css({
770              'paddingTop': header_height + et_pb_first_row_first_module_code_padding_top
771            });
772          } else if ($et_pb_first_row_first_module.is('.et_pb_post_title')) {
773            /* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */
774            var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module; // Save current styling for the next resize cycle
775
776            et_save_initial_page_container_style($et_pb_first_row_first_module_title, 'paddingTop');
777            $et_pb_first_row_first_module.css({
778              'paddingTop': header_height + 50
779            });
780          } else if (!$et_pb_first_row_first_module.length) {
781            // Get current padding top
782            et_pb_first_row_padding_top = parseFloat($et_pb_first_row.css('paddingTop')); // Save current styling for the next resize cycle
783
784            et_save_initial_page_container_style($et_pb_first_row, 'paddingTop'); // Keep the state of previous cycle. The padding top is reset to the first
785            // cycle by default (padding-top: 0px) so if previous cycle didn't hide the
786            // nav, automatically add the additional padding top
787
788            if (!$et_pb_first_row.data('is_hide_nav')) {
789              $et_pb_first_row.css({
790                'paddingTop': et_pb_first_row_padding_top + header_height
791              });
792            } // Use timeout to avoid flickering padding top when window is resized vertically
793            // and hidden nav is transitioned to visible nav, vice versa.
794
795
796            clearTimeout(window.et_fallback_transparent_adjustment_timeout);
797            window.et_fallback_transparent_adjustment_timeout = setTimeout(function () {
798              // Hidden nav can be decided by the existance of et_hide_nav class AND
799              // the css transform attribute value because the visibility of nav is
800              // modified by CSS transition
801              var is_hide_nav = $('body').hasClass('et_hide_nav') && $('#main-header').css('transform') !== 'matrix(1, 0, 0, 1, 0, 0)'; // Add / remove additional top padding accordingly
802
803              if (is_hide_nav) {
804                $et_pb_first_row.css({
805                  'paddingTop': ''
806                });
807              } else {
808                $et_pb_first_row.css({
809                  'paddingTop': et_pb_first_row_padding_top + header_height
810                });
811              } // Save current nav state for next cycle assessment
812
813
814              $et_pb_first_row.data('is_hide_nav', is_hide_nav);
815            }, 300);
816          }
817        } else if (is_pb) {
818          /* Desktop / Mobile + Pagebuilder + Regular section */
819          // Remove first row's inline padding top styling to prevent looping padding-top calculation
820          $et_pb_first_row.css({
821            'paddingTop': ''
822          }); // Get saved custom padding from data-* attributes. Builder automatically adds
823          // saved custom paddings to data-* attributes on first section
824
825          var saved_custom_padding = $et_pb_first_row.attr('data-padding'),
826              saved_custom_padding_top = et_get_saved_padding_margin_value(saved_custom_padding, 0),
827              saved_custom_padding_tablet = $et_pb_first_row.attr('data-padding-tablet'),
828              saved_custom_padding_tablet_top = et_get_saved_padding_margin_value(saved_custom_padding_tablet, 0),
829              saved_custom_padding_phone = $et_pb_first_row.attr('data-padding-phone'),
830              saved_custom_padding_phone_top = et_get_saved_padding_margin_value(saved_custom_padding_phone, 0),
831              applied_saved_custom_padding;
832
833          if (saved_custom_padding_top || saved_custom_padding_tablet_top || saved_custom_padding_phone_top) {
834            // Applies padding top to first section to automatically convert saved unit into px
835            if (et_window_width > 980 && saved_custom_padding_top) {
836              $et_pb_first_row.css({
837                paddingTop: saved_custom_padding_top
838              });
839            } else if (et_window_width > 767 && saved_custom_padding_tablet_top) {
840              $et_pb_first_row.css({
841                paddingTop: saved_custom_padding_tablet_top
842              });
843            } else if (saved_custom_padding_phone_top) {
844              $et_pb_first_row.css({
845                paddingTop: saved_custom_padding_phone_top
846              });
847            } // Get converted custom padding top value
848
849
850            applied_saved_custom_padding = parseInt($et_pb_first_row.css('paddingTop')); // Implemented saved & converted padding top + header height
851
852            $et_pb_first_row.css({
853              paddingTop: header_height + applied_saved_custom_padding
854            });
855          } else {
856            // Pagebuilder ignores #main-content .container's fixed height and uses its row's padding
857            // Anticipate the use of custom section padding.
858            et_pb_first_row_padding_top = header_height + parseInt($et_pb_first_row.css('paddingTop')); // Save current styling for the next resize cycle
859
860            et_save_initial_page_container_style($et_pb_first_row, 'paddingTop'); // Implementing padding-top + header_height
861
862            $et_pb_first_row.css({
863              'paddingTop': et_pb_first_row_padding_top
864            });
865          }
866        } else if (is_no_pb_mobile) {
867          // Mobile + not pagebuilder
868          $et_main_content_first_row.css({
869            'paddingTop': header_height
870          });
871        } else {
872          $('#main-content .container:first-child').css({
873            'paddingTop': header_height
874          });
875        } // Set #page-container's padding-top to zero after inline styling first row's content has been added
876
877
878        if (!$('#et_fix_page_container_position').length) {
879          $('<style />', {
880            'id': 'et_fix_page_container_position',
881            'text': '#page-container{ padding-top: 0 !important;}'
882          }).appendTo('head');
883        } // If the first visible (visibility is significant for for cached split test) section/row/module has
884        // parallax background, trigger parallax height resize so the parallax location is correctly rendered
885        // due to addition of first section/row/module margin-top/padding-top which is needed for transparent
886        // primary nav
887
888
889        var $firstSection = $('.et_pb_section:visible:first');
890        var $firstRow = $firstSection.find('.et_pb_row:visible:first');
891        var $firstModule = $firstSection.find('.et_pb_module:visible:first');
892        var firstSectionHasParallax = $firstSection.hasClass('et_pb_section_parallax');
893        var firstRowHasParallax = $firstRow.hasClass('et_pb_section_parallax');
894        var firstModuleHasParallax = $firstModule.hasClass('et_pb_section_parallax');
895
896        if (firstSectionHasParallax || firstRowHasParallax || firstModuleHasParallax) {
897          $(window).trigger('resize.etTrueParallaxBackground');
898        }
899      } else if (et_is_fixed_nav) {
900        $main_container_wrapper.css('paddingTop', header_height);
901      }
902
903      $mainHeaderClone.remove();
904      et_change_primary_nav_position(0);
905      $(document).trigger('et-pb-header-height-calculated');
906    }
907
908    window.et_fix_page_container_position = et_fix_page_container_position; // Save container width on page load for reference
909
910    $et_container.data('previous-width', parseInt($et_container.width()));
911    var update_page_container_position = et_debounce(function () {
912      et_fix_page_container_position();
913
914      if (typeof et_fix_fullscreen_section === 'function') {
915        et_fix_fullscreen_section();
916      }
917    }, 200);
918    $(window).resize(function () {
919      var window_width = parseInt($et_window.width()),
920          has_container = $et_container.length > 0,
921          et_container_previous_width = !has_container ? 0 : parseInt($et_container.data('previous-width')) || 0,
922          et_container_css_width = $et_container.css('width'),
923          et_container_width_in_pixel = typeof et_container_css_width !== 'undefined' ? et_container_css_width.substr(-1, 1) !== '%' : '',
924          et_container_actual_width = !has_container ? 0 : et_container_width_in_pixel ? parseInt($et_container.width()) : parseInt((parseInt($et_container.width()) / 100).toFixed(0)) * window_width,
925          // $et_container.width() doesn't recognize pixel or percentage unit. It's our duty to understand what it returns and convert it properly
926      containerWidthChanged = $et_container.length && et_container_previous_width !== et_container_actual_width,
927          $slide_menu_container = $('.et_slide_in_menu_container'),
928          $adminbar = isBuilder ? top_window.jQuery('#wpadminbar') : $('#wpadminbar'),
929          is_rtl = $('body').hasClass('rtl'),
930          page_container_margin;
931
932      if (et_is_fixed_nav && containerWidthChanged) {
933        update_page_container_position(); // Update container width data for future resizing reference
934
935        $et_container.data('previous-width', et_container_actual_width);
936      }
937
938      if (et_hide_nav) {
939        et_hide_nav_transform();
940      } // Update header and primary adjustment when transitioning across breakpoints or inside visual builder
941
942
943      if ($adminbar.length && et_is_fixed_nav && window_width >= 740 && window_width <= 782 || isBuilder) {
944        et_calculate_header_values();
945        et_change_primary_nav_position(0);
946      }
947
948      et_set_search_form_css();
949
950      if ($slide_menu_container.length && !$('body').hasClass('et_pb_slide_menu_active')) {
951        if (is_rtl) {
952          $slide_menu_container.css({
953            left: '-' + parseInt($slide_menu_container.innerWidth()) + 'px',
954            right: 'unset'
955          });
956        } else {
957          $slide_menu_container.css({
958            right: '-' + parseInt($slide_menu_container.innerWidth()) + 'px'
959          });
960        }
961
962        if ($('body').hasClass('et_boxed_layout') && et_is_fixed_nav) {
963          if (is_rtl) {
964            page_container_margin = $main_container_wrapper.css('margin-right');
965            $main_header.css({
966              right: page_container_margin
967            });
968          } else {
969            page_container_margin = $main_container_wrapper.css('margin-left');
970            $main_header.css({
971              left: page_container_margin
972            });
973          }
974        }
975      }
976
977      if ($slide_menu_container.length && $('body').hasClass('et_pb_slide_menu_active')) {
978        if ($('body').hasClass('et_boxed_layout')) {
979          var left_position;
980          page_container_margin = parseFloat($main_container_wrapper.css('margin-left'));
981          $main_container_wrapper.css({
982            left: '-' + (parseInt($slide_menu_container.innerWidth()) - page_container_margin) + 'px'
983          });
984
985          if (et_is_fixed_nav) {
986            left_position = 0 > parseInt($slide_menu_container.innerWidth()) - page_container_margin * 2 ? Math.abs($slide_menu_container.innerWidth() - page_container_margin * 2) : '-' + ($slide_menu_container.innerWidth() - page_container_margin * 2);
987
988            if (left_position < parseInt($slide_menu_container.innerWidth())) {
989              $main_header.css({
990                left: left_position + 'px'
991              });
992            }
993          }
994        } else {
995          if (is_rtl) {
996            $('#page-container, .et_fixed_nav #main-header').css({
997              right: '-' + parseInt($slide_menu_container.innerWidth()) + 'px'
998            });
999          } else {
1000            $('#page-container, .et_fixed_nav #main-header').css({
1001              left: '-' + parseInt($slide_menu_container.innerWidth()) + 'px'
1002            });
1003          }
1004        }
1005      } // adjust the padding in fullscreen menu
1006
1007
1008      if ($slide_menu_container.length && $('body').hasClass('et_header_style_fullscreen')) {
1009        var top_bar_height = parseInt($slide_menu_container.find('.et_slide_menu_top').innerHeight());
1010        $slide_menu_container.css({
1011          'padding-top': top_bar_height + 20
1012        });
1013      }
1014
1015      et_set_right_vertical_menu();
1016    });
1017
1018    if (isBuilder && jQuery('.et_header_style_fullscreen .et_slide_in_menu_container').length > 0) {
1019      jQuery(window).resize(et_pb_resize_fullscreen_menu);
1020    }
1021
1022    $(window).ready(function () {
1023      if ($.fn.fitVids) {
1024        $('#main-content').fitVids({
1025          customSelector: "iframe[src^='http://www.hulu.com'], iframe[src^='http://www.dailymotion.com'], iframe[src^='http://www.funnyordie.com'], iframe[src^='https://embed-ssl.ted.com'], iframe[src^='http://embed.revision3.com'], iframe[src^='https://flickr.com'], iframe[src^='http://blip.tv'], iframe[src^='http://www.collegehumor.com']"
1026        });
1027      }
1028    });
1029
1030    function et_all_elements_loaded() {
1031      if (et_is_fixed_nav) {
1032        et_calculate_header_values();
1033      } // Run container position calculation with 0 timeout to make sure all elements are ready for proper calculation.
1034
1035
1036      setTimeout(function () {
1037        et_fix_page_container_position();
1038      }, 0); // Minified JS is ordered differently to avoid jquery-migrate to cause js error.
1039      // This might cause hiccup on some specific configuration (ie. parallax of first module on transparent nav)
1040      // Triggerring resize, in most case, re-calculate the UI correctly
1041
1042      if (window.et_is_minified_js && window.et_is_transparent_nav && !window.et_is_vertical_nav) {
1043        $(window).trigger('resize');
1044      }
1045
1046      if (window.hasOwnProperty('et_location_hash') && '' !== window.et_location_hash) {
1047        // Handle the page scroll that we prevented earlier in the <head>
1048        et_page_load_scroll_to_anchor();
1049      }
1050
1051      if (et_header_style_left && !window.et_is_vertical_nav) {
1052        var $logo_width = parseInt($('#logo').width());
1053
1054        if (et_is_rtl) {
1055          $et_top_navigation.css('padding-right', $logo_width + 30);
1056        } else {
1057          $et_top_navigation.css('padding-left', $logo_width + 30);
1058        }
1059      }
1060
1061      if ($('p.demo_store').length && $('p.demo_store').is(':visible')) {
1062        $('#footer-bottom').css('margin-bottom', $('p.demo_store').innerHeight());
1063        $('.woocommerce-store-notice__dismiss-link').click(function () {
1064          $('#footer-bottom').css('margin-bottom', '');
1065        });
1066      }
1067
1068      if ($.fn.waypoint) {
1069        var $waypoint_selector;
1070
1071        if (et_is_vertical_fixed_nav) {
1072          $waypoint_selector = $('#main-content');
1073          $waypoint_selector.waypoint({
1074            handler: function handler(direction) {
1075              et_fix_logo_transition();
1076
1077              if (direction === 'down') {
1078                $('#main-header').addClass('et-fixed-header');
1079              } else {
1080                $('#main-header').removeClass('et-fixed-header');
1081              }
1082            }
1083          });
1084        }
1085
1086        if (et_is_fixed_nav) {
1087          // Changing waypoint selector to first section's row / module when transparent
1088          // nav is used only valid if the first section position is on offset top = 0
1089          // (or 32 when admin bar exist) to avoid `et-fixed-nav` classname being added
1090          // too late when the window is scrolled too way down
1091          var firstRowOffsetTop = $et_pb_first_row.length > 0 ? $et_pb_first_row.offset().top : 0;
1092          var maxFirstRowOffsetTop = $('#wpadminbar').length ? $('#wpadminbar').height() : 0;
1093          var isFirstRowOnTop = firstRowOffsetTop <= maxFirstRowOffsetTop;
1094
1095          if (isFirstRowOnTop && window.et_is_transparent_nav && !window.et_is_vertical_nav && $et_pb_first_row.length) {
1096            // Fullscreen section at the first row requires specific adjustment
1097            if ($et_pb_first_row.is('.et_pb_fullwidth_section')) {
1098              $waypoint_selector = $et_pb_first_row.children('.et_pb_module:visible:first');
1099            } else {
1100              $waypoint_selector = $et_pb_first_row.find('.et_pb_row:visible:first');
1101            } // Fallback for a less likely but possible scenario: a) fullwidth section
1102            // has no module OR b) other section has no row. When this happened,
1103            // the safest option is look for the first visible module and use it
1104            // as waypoint selector
1105
1106
1107            if (!$waypoint_selector.length) {
1108              $waypoint_selector = et_get_first_module();
1109            }
1110          } else if (isFirstRowOnTop && window.et_is_transparent_nav && !window.et_is_vertical_nav && $et_main_content_first_row.length) {
1111            $waypoint_selector = $('#content-area');
1112          } else {
1113            $waypoint_selector = $('#main-content');
1114          } // Disabled section/row/module can cause waypoint to trigger 'down' event during its setup even if
1115          // no scrolling happened, which would result in 'et-fixed-header' class being prematurely added.
1116          // Since this only happens when page is loaded, we add an extra check that is no longer needed
1117          // as soon as waypoint initialization is finished.
1118
1119
1120          var checkIfScrolled = true;
1121          setTimeout(function () {
1122            checkIfScrolled = false;
1123          }, 0);
1124          $waypoint_selector.waypoint({
1125            offset: function offset() {
1126              if (etRecalculateOffset) {
1127                setTimeout(function () {
1128                  et_calculate_header_values();
1129                }, 200);
1130                etRecalculateOffset = false;
1131              }
1132
1133              if (et_hide_nav) {
1134                return et_header_offset - et_header_height - 200;
1135              } else {
1136                // Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height
1137                var waypoint_selector_offset = $waypoint_selector.offset();
1138
1139                if (waypoint_selector_offset.top < et_header_offset) {
1140                  et_header_offset = 0 - (et_header_offset - waypoint_selector_offset.top);
1141                }
1142
1143                return et_header_offset;
1144              }
1145            },
1146            handler: function handler(direction) {
1147              et_fix_logo_transition();
1148
1149              if (direction === 'down') {
1150                if (checkIfScrolled && $et_window.scrollTop() === 0) {
1151                  return;
1152                }
1153
1154                $main_header.addClass('et-fixed-header');
1155                $main_container_wrapper.addClass('et-animated-content');
1156                $top_header.addClass('et-fixed-header');
1157
1158                if (!et_hide_nav && !window.et_is_transparent_nav && !$('.mobile_menu_bar_toggle').is(':visible')) {
1159                  var secondary_nav_height = $top_header.length ? parseInt($top_header.height()) : 0,
1160                      $clone_header,
1161                      clone_header_height,
1162                      fix_padding;
1163                  $clone_header = $main_header.clone().addClass('et-fixed-header, et_header_clone').css({
1164                    'transition': 'none',
1165                    'display': 'none'
1166                  });
1167                  clone_header_height = parseInt($clone_header.prependTo('body').height()); // Vertical nav doesn't need #page-container margin-top adjustment
1168
1169                  if (!window.et_is_vertical_nav) {
1170                    fix_padding = parseInt($main_container_wrapper.css('padding-top')) - clone_header_height - secondary_nav_height + 1;
1171                    $main_container_wrapper.css('margin-top', -fix_padding);
1172                  }
1173
1174                  $('.et_header_clone').remove();
1175                }
1176              } else {
1177                $main_header.removeClass('et-fixed-header');
1178                $top_header.removeClass('et-fixed-header');
1179                $main_container_wrapper.css('margin-top', '-1px');
1180              }
1181
1182              setTimeout(function () {
1183                et_set_search_form_css();
1184              }, 400);
1185            }
1186          });
1187        }
1188
1189        if (et_hide_nav) {
1190          et_hide_nav_transform();
1191        }
1192      }
1193    }
1194
1195    $('a[href*="#"]:not([href="#"])').click(function () {
1196      var $this_link = $(this),
1197          has_closest_smooth_scroll_disabled = $this_link.closest('.et_smooth_scroll_disabled').length,
1198          has_closest_woocommerce_tabs = $this_link.closest('.woocommerce-tabs').length && $this_link.closest('.tabs').length,
1199          has_closest_timetable_tab = $this_link.closest('.tt_tabs_navigation').length,
1200          has_closest_eab_cal_link = $this_link.closest('.eab-shortcode_calendar-navigation-link').length,
1201          has_closest_ee_cart_link = $this_link.closest('.view-cart-lnk').length,
1202          has_acomment_reply = $this_link.hasClass('acomment-reply'),
1203          is_woocommerce_review_link = $this_link.hasClass('woocommerce-review-link'),
1204          disable_scroll = has_closest_smooth_scroll_disabled || has_closest_ee_cart_link || has_closest_woocommerce_tabs || has_closest_eab_cal_link || has_acomment_reply || is_woocommerce_review_link || has_closest_timetable_tab;
1205
1206      if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname && !disable_scroll) {
1207        var target = $(this.hash);
1208        target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
1209
1210        if (target.length) {
1211          // automatically close fullscreen menu if clicked from there
1212          if ($this_link.closest('.et_pb_fullscreen_menu_opened').length > 0) {
1213            et_pb_toggle_fullscreen_menu();
1214          }
1215
1216          setTimeout(function () {
1217            et_pb_smooth_scroll(target, false, 800);
1218          }, 0);
1219
1220          if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && $(window).width() > 980) {
1221            setTimeout(function () {
1222              et_pb_smooth_scroll(target, false, 40, 'linear');
1223            }, 780);
1224          }
1225
1226          return false;
1227        }
1228      }
1229    });
1230
1231    var et_pb_window_side_nav_get_sections = function et_pb_window_side_nav_get_sections() {
1232      var $inPost = $('.et-l--post .et_pb_section');
1233      var $inTBBody = $('.et-l--body .et_pb_section').not('.et-l--post .et_pb_section');
1234
1235      if (0 === $inTBBody.length || $inPost.length > 1) {
1236        return $inPost;
1237      }
1238
1239      return $inTBBody;
1240    };
1241
1242    window.et_pb_window_side_nav_scroll_init = function () {
1243      if (true === window.et_calculating_scroll_position || false === window.et_side_nav_links_initialized) {
1244        return;
1245      }
1246
1247      var $sections = et_pb_window_side_nav_get_sections();
1248      window.et_calculating_scroll_position = true;
1249      var is_tb_layout_used = $('.et-l--header').length || $('.et-l--body').length || !$('#main-header').length;
1250      var add_offset_default = is_tb_layout_used ? 0 : -90;
1251      var add_offset = $('body').hasClass('et_fixed_nav') ? 20 : add_offset_default;
1252      var top_header_height = $('#top-header').length > 0 ? parseInt($('#top-header').height()) : 0;
1253      var main_header_height = $('#main-header').length > 0 ? parseInt($('#main-header').height()) : 0;
1254      var side_offset;
1255
1256      if ($('#wpadminbar').length > 0 && parseInt($(window).width()) > 600) {
1257        add_offset += parseInt($('#wpadminbar').outerHeight());
1258      }
1259
1260      if (window.et_is_vertical_nav) {
1261        side_offset = top_header_height + add_offset + 60;
1262      } else {
1263        side_offset = top_header_height + main_header_height + add_offset;
1264      }
1265
1266      var window_height = parseInt($(window).height());
1267      var scroll_position = parseInt($(window).scrollTop());
1268      var document_height = parseInt($(document).height());
1269      var at_bottom_of_page = window_height + scroll_position === document_height;
1270      var total_links = $('.side_nav_item a').length - 1;
1271
1272      for (var link = 0; link <= total_links; link++) {
1273        var $target_section = $sections.eq(link);
1274        var at_top_of_page = 'undefined' === typeof $target_section.offset();
1275        var current_active = $('.side_nav_item a.active').parent().index();
1276        var next_active = null;
1277        var target_offset = false === at_top_of_page ? $target_section.offset().top - side_offset : 0;
1278
1279        if (at_top_of_page) {
1280          next_active = 0;
1281        } else if (at_bottom_of_page) {
1282          next_active = total_links;
1283        } else if (scroll_position >= target_offset) {
1284          next_active = link;
1285        }
1286
1287        if (null !== next_active && next_active !== current_active) {
1288          $('.side_nav_item a').removeClass('active');
1289          $('a#side_nav_item_id_' + next_active).addClass('active');
1290        }
1291      }
1292
1293      window.et_calculating_scroll_position = false;
1294    };
1295
1296    window.et_pb_side_nav_page_init = function () {
1297      var $sections = et_pb_window_side_nav_get_sections();
1298      var total_sections = $sections.length;
1299      var side_nav_offset = parseInt((total_sections * 20 + 40) / 2);
1300      window.et_side_nav_links_initialized = false;
1301      window.et_calculating_scroll_position = false;
1302
1303      if (total_sections > 1 && $('.et_pb_side_nav_page').length) {
1304        $('#main-content').append('<ul class="et_pb_side_nav"></ul>');
1305        $sections.each(function (index, element) {
1306          var active_class = 0 === index ? 'active' : '';
1307          $('.et_pb_side_nav').append('<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + index + '" class= "' + active_class + '">' + index + '</a></li>');
1308
1309          if (total_sections - 1 === index) {
1310            window.et_side_nav_links_initialized = true;
1311          }
1312        });
1313        $('ul.et_pb_side_nav').css('marginTop', '-' + side_nav_offset + 'px');
1314        $('.et_pb_side_nav').addClass('et-visible');
1315        $('.et_pb_side_nav a').click(function () {
1316          // We use the index position of the sections to locate them instead of custom classes so
1317          // that we have the same implementation for the frontend website and the Visual Builder.
1318          var index = parseInt($(this).text());
1319          var $target = $sections.eq(index);
1320          var top_section = $(this).text() == "0" && !$('.et-l--body').length;
1321          et_pb_smooth_scroll($target, top_section, 800);
1322
1323          if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && parseInt($(window).width()) > 980) {
1324            setTimeout(function () {
1325              et_pb_smooth_scroll($target, top_section, 200);
1326            }, 500);
1327          }
1328
1329          return false;
1330        });
1331        $(window).on('scroll', et_pb_window_side_nav_scroll_init);
1332      }
1333    };
1334
1335    if ($('body').is('.et-fb, .et-bfb')) {
1336      // Debounce slow function
1337      window.et_pb_side_nav_page_init = et_debounce(window.et_pb_side_nav_page_init, 200);
1338    }
1339
1340    et_pb_side_nav_page_init();
1341
1342    if ($('.et_pb_scroll_top').length) {
1343      $(window).scroll(function () {
1344        if ($(this).scrollTop() > 800) {
1345          $('.et_pb_scroll_top').show().removeClass('et-hidden').addClass('et-visible');
1346        } else {
1347          $('.et_pb_scroll_top').removeClass('et-visible').addClass('et-hidden');
1348        }
1349      }); //Click event to scroll to top
1350
1351      $('.et_pb_scroll_top').click(function () {
1352        $('html, body').animate({
1353          scrollTop: 0
1354        }, 800);
1355      });
1356    }
1357
1358    if ($('.comment-reply-link').length) {
1359      $('.comment-reply-link').addClass('et_pb_button');
1360    }
1361
1362    $('#et_top_search').click(function () {
1363      var $search_container = $('.et_search_form_container');
1364
1365      if ($search_container.hasClass('et_pb_is_animating')) {
1366        return;
1367      }
1368
1369      $('.et_menu_container').removeClass('et_pb_menu_visible et_pb_no_animation').addClass('et_pb_menu_hidden');
1370      $search_container.removeClass('et_pb_search_form_hidden et_pb_no_animation').addClass('et_pb_search_visible et_pb_is_animating');
1371      setTimeout(function () {
1372        $('.et_menu_container').addClass('et_pb_no_animation');
1373        $search_container.addClass('et_pb_no_animation').removeClass('et_pb_is_animating');
1374      }, 1000);
1375      $search_container.find('input').focus();
1376      et_set_search_form_css();
1377    });
1378
1379    function et_hide_search() {
1380      if ($('.et_search_form_container').hasClass('et_pb_is_animating')) {
1381        return;
1382      }
1383
1384      $('.et_menu_container').removeClass('et_pb_menu_hidden et_pb_no_animation').addClass('et_pb_menu_visible');
1385      $('.et_search_form_container').removeClass('et_pb_search_visible et_pb_no_animation').addClass('et_pb_search_form_hidden et_pb_is_animating');
1386      setTimeout(function () {
1387        $('.et_menu_container').addClass('et_pb_no_animation');
1388        $('.et_search_form_container').addClass('et_pb_no_animation').removeClass('et_pb_is_animating');
1389      }, 1000);
1390    }
1391
1392    function et_set_search_form_css() {
1393      var $search_container = $('.et_search_form_container');
1394      var $body = $('body');
1395
1396      if ($search_container.hasClass('et_pb_search_visible')) {
1397        var header_height = $('#main-header').innerHeight(),
1398            menu_width = $('#top-menu').width(),
1399            font_size = $('#top-menu li a').css('font-size');
1400        $search_container.css({
1401          'height': header_height + 'px'
1402        });
1403        $search_container.find('input').css('font-size', font_size);
1404
1405        if (!$body.hasClass('et_header_style_left')) {
1406          $search_container.css('max-width', menu_width + 60);
1407        } else {
1408          $search_container.find('form').css('max-width', menu_width + 60);
1409        }
1410      }
1411    }
1412
1413    $('.et_close_search_field').click(function () {
1414      et_hide_search();
1415    });
1416    $(document).mouseup(function (e) {
1417      var $header = $('#main-header');
1418
1419      if ($('.et_menu_container').hasClass('et_pb_menu_hidden')) {
1420        if (!$header.is(e.target) && $header.has(e.target).length === 0) {
1421          et_hide_search();
1422        }
1423      }
1424    }); // Detect actual logo dimension, used for tricky fixed navigation transition
1425
1426    function et_define_logo_dimension() {
1427      var $logo = $('#logo'),
1428          logo_src = $logo.attr('src'),
1429          is_svg = logo_src.substr(-3, 3) === 'svg' ? true : false,
1430          $logo_wrap,
1431          logo_width,
1432          logo_height; // Append invisible wrapper at the bottom of the page
1433
1434      $('body').append($('<div />', {
1435        'id': 'et-define-logo-wrap',
1436        'style': 'position: fixed; bottom: 0; opacity: 0;'
1437      })); // Define logo wrap
1438
1439      $logo_wrap = $('#et-define-logo-wrap');
1440
1441      if (is_svg) {
1442        $logo_wrap.addClass('svg-logo');
1443      } // Clone logo to invisible wrapper
1444
1445
1446      $logo_wrap.html($logo.clone().css({
1447        'display': 'block'
1448      }).removeAttr('id')); // Get dimension
1449
1450      logo_width = $logo_wrap.find('img').width();
1451      logo_height = $logo_wrap.find('img').height(); // Add data attribute to $logo
1452
1453      $logo.attr({
1454        'data-actual-width': logo_width,
1455        'data-actual-height': logo_height
1456      }); // Destroy invisible wrapper
1457
1458      $logo_wrap.remove(); // Init logo transition onload
1459
1460      et_fix_logo_transition(true);
1461    }
1462
1463    if ($('#logo').length) {
1464      // Wait until logo is loaded before performing logo dimension fix
1465      // This comes handy when the page is heavy due to the use of images or other assets
1466      et_preload_image($('#logo').attr('src'), et_define_logo_dimension);
1467    } // Set width for adsense in footer widget
1468
1469
1470    $('.footer-widget').each(function () {
1471      var $footer_widget = $(this),
1472          footer_widget_width = $footer_widget.width(),
1473          $adsense_ins = $footer_widget.find('.widget_adsensewidget ins');
1474
1475      if ($adsense_ins.length) {
1476        $adsense_ins.width(footer_widget_width);
1477      }
1478    });
1479    /**
1480     * Visual Builder adjustment
1481     */
1482
1483    function et_fb_side_nav_page_init() {
1484      $(window).off('scroll', window.et_pb_window_side_nav_scroll_init);
1485      $('#main-content .et_pb_side_nav').off('click', '.et_pb_side_nav a');
1486      $('#main-content .et_pb_side_nav').remove();
1487      et_pb_side_nav_page_init();
1488    }
1489
1490    if ($('body').is('.et-fb')) {
1491      $(window).on('et_fb_root_did_mount', function () {
1492        et_fb_side_nav_page_init();
1493        et_all_elements_loaded();
1494      });
1495      $(window).on('et_fb_section_content_change', et_fb_side_nav_page_init);
1496    } else {
1497      $(window).load(et_all_elements_loaded);
1498    }
1499  }); // Fixing logo size transition in tricky header style
1500
1501  function et_fix_logo_transition(is_onload) {
1502    var $body = $('body'),
1503        $logo = $('#logo'),
1504        logo_actual_width = parseInt($logo.attr('data-actual-width')),
1505        logo_actual_height = parseInt($logo.attr('data-actual-height')),
1506        logo_height_percentage = parseInt($logo.attr('data-height-percentage')),
1507        $top_nav = $('#et-top-navigation'),
1508        top_nav_height = parseInt($top_nav.attr('data-height')),
1509        top_nav_fixed_height = parseInt($top_nav.attr('data-fixed-height')),
1510        $main_header = $('#main-header'),
1511        is_header_split = $body.hasClass('et_header_style_split'),
1512        is_fixed_nav = $main_header.hasClass('et-fixed-header'),
1513        is_hide_primary_logo = $body.hasClass('et_hide_primary_logo'),
1514        is_hide_fixed_logo = $body.hasClass('et_hide_fixed_logo'),
1515        logo_height_base = is_fixed_nav ? top_nav_height : top_nav_fixed_height,
1516        logo_wrapper_width,
1517        logo_wrapper_height;
1518    is_onload = typeof is_onload === 'undefined' ? false : is_onload; // Fix for inline centered logo in horizontal nav
1519
1520    if (is_header_split && !window.et_is_vertical_nav) {
1521      // On page load, logo_height_base should be top_nav_height
1522      if (is_onload) {
1523        logo_height_base = top_nav_height;
1524      } // Calculate logo wrapper height
1525
1526
1527      logo_wrapper_height = logo_height_base * (logo_height_percentage / 100) + 22; // Calculate logo wrapper width
1528
1529      logo_wrapper_width = logo_actual_width * (logo_wrapper_height / logo_actual_height); // Override logo wrapper width to 0 if it is hidden
1530
1531      if (is_hide_primary_logo && (is_fixed_nav || is_onload)) {
1532        logo_wrapper_width = 0;
1533      }
1534
1535      if (is_hide_fixed_logo && !is_fixed_nav && !is_onload) {
1536        logo_wrapper_width = 0;
1537      }
1537 // Set fixed width for logo wrapper to force correct dimension
1538
1539
1540      $('.et_header_style_split .centered-inline-logo-wrap').css({
1541        'width': logo_wrapper_width
1542      });
1543    }
1544  }
1545
1546  function et_toggle_slide_menu(force_state) {
1547    var $slide_menu_container = $('.et_header_style_slide .et_slide_in_menu_container'),
1548        $page_container = $('.et_header_style_slide #page-container, .et_header_style_slide.et_fixed_nav #main-header'),
1549        $header_container = $('.et_header_style_slide #main-header'),
1550        is_menu_opened = $slide_menu_container.hasClass('et_pb_slide_menu_opened'),
1551        set_to = typeof force_state !== 'undefined' ? force_state : 'auto',
1552        is_boxed_layout = $('body').hasClass('et_boxed_layout'),
1553        page_container_margin = is_boxed_layout ? parseFloat($('#page-container').css('margin-left')) : 0,
1554        slide_container_width = $slide_menu_container.innerWidth(),
1555        is_rtl = $('body').hasClass('rtl');
1556
1557    if ('auto' !== set_to && (is_menu_opened && 'open' === set_to || !is_menu_opened && 'close' === set_to)) {
1558      return;
1559    }
1560
1561    if (is_menu_opened) {
1562      if (is_rtl) {
1563        $slide_menu_container.css({
1564          left: '-' + slide_container_width + 'px'
1565        });
1566        $page_container.css({
1567          right: '0'
1568        });
1569      } else {
1570        $slide_menu_container.css({
1571          right: '-' + slide_container_width + 'px'
1572        });
1573        $page_container.css({
1574          left: '0'
1575        });
1576      }
1577
1578      if (is_boxed_layout && et_is_fixed_nav) {
1579        if (is_rtl) {
1580          $header_container.css({
1581            right: page_container_margin + 'px'
1582          });
1583        } else {
1584          $header_container.css({
1585            left: page_container_margin + 'px'
1586          });
1587        }
1588      } // hide the menu after animation completed
1589
1590
1591      setTimeout(function () {
1592        $slide_menu_container.css({
1593          'display': 'none'
1594        });
1595      }, 700);
1596    } else {
1597      $slide_menu_container.css({
1598        'display': 'block'
1599      }); // add some delay to make sure css animation applied correctly
1600
1601      setTimeout(function () {
1602        if (is_rtl) {
1603          $slide_menu_container.css({
1604            left: '0'
1605          });
1606          $page_container.css({
1607            right: '-' + (slide_container_width - page_container_margin) + 'px'
1608          });
1609        } else {
1610          $slide_menu_container.css({
1611            right: '0'
1612          });
1613          $page_container.css({
1614            left: '-' + (slide_container_width - page_container_margin) + 'px'
1615          });
1616        }
1617
1618        if (is_boxed_layout && et_is_fixed_nav) {
1619          var left_position = 0 > slide_container_width - page_container_margin * 2 ? Math.abs(slide_container_width - page_container_margin * 2) : '-' + (slide_container_width - page_container_margin * 2);
1620
1621          if (left_position < slide_container_width) {
1622            if (is_rtl) {
1623              $header_container.css({
1624                right: left_position + 'px'
1625              });
1626            } else {
1627              $header_container.css({
1628                left: left_position + 'px'
1629              });
1630            }
1631          }
1632        }
1633      }, 50);
1634    }
1635
1636    $('body').toggleClass('et_pb_slide_menu_active');
1637    $slide_menu_container.toggleClass('et_pb_slide_menu_opened');
1638  } // Scrolling to the correct place on page if Fixed Nav enabled
1639
1640
1641  function et_adjust_woocommerce_checkout_scroll() {
1642    if (!et_is_fixed_nav) {
1643      return;
1644    }
1645
1646    var window_width = parseInt($et_window.width());
1647
1648    if (980 >= window_width) {
1649      return;
1650    }
1651
1652    var headerHeight = parseInt($('#main-header').innerHeight()); // scroll to the top of checkout form taking into account fixed header height
1653
1654    $('html, body').animate({
1655      scrollTop: $('form.checkout').offset().top - 100 - headerHeight
1656    }, 1000);
1657  }
1658
1659  $('#main-header').on('click', '.et_toggle_slide_menu', function () {
1660    et_toggle_slide_menu();
1661  });
1662
1663  if (et_is_touch_device) {
1664    // open slide menu on swipe left
1665    $et_window.on('swipeleft', function (event) {
1666      var window_width = parseInt($et_window.width()),
1667          swipe_start = parseInt(event.swipestart.coords[0]); // horizontal coordinates of the swipe start
1668      // if swipe started from the right edge of screen then open slide menu
1669
1670      if (30 >= window_width - swipe_start) {
1671        et_toggle_slide_menu('open');
1672      }
1673    }); // close slide menu on swipe right
1674
1675    $et_window.on('swiperight', function (event) {
1676      if ($('body').hasClass('et_pb_slide_menu_active')) {
1677        et_toggle_slide_menu('close');
1678      }
1679    });
1680  }
1681
1682  $('#page-container').on('click', '.et_toggle_fullscreen_menu', function () {
1683    et_pb_toggle_fullscreen_menu();
1684  });
1685
1686  function et_pb_toggle_fullscreen_menu() {
1687    var $menu_container = $('.et_header_style_fullscreen .et_slide_in_menu_container'),
1688        top_bar_height = $menu_container.find('.et_slide_menu_top').innerHeight();
1689    $menu_container.toggleClass('et_pb_fullscreen_menu_opened');
1690    $('body').toggleClass('et_pb_fullscreen_menu_active');
1691    et_pb_resize_fullscreen_menu();
1692
1693    if ($menu_container.hasClass('et_pb_fullscreen_menu_opened')) {
1694      $menu_container.addClass('et_pb_fullscreen_menu_animated'); // adjust the padding in fullscreen menu
1695
1696      $menu_container.css({
1697        'padding-top': top_bar_height + 20
1698      });
1699    } else {
1700      setTimeout(function () {
1701        $menu_container.removeClass('et_pb_fullscreen_menu_animated');
1702      }, 1000);
1703    }
1704  }
1705
1706  function et_pb_resize_fullscreen_menu(e) {
1707    if (isBuilder) {
1708      var $menu = jQuery('.et_header_style_fullscreen .et_slide_in_menu_container.et_pb_fullscreen_menu_opened');
1709
1710      if ($menu.length > 0) {
1711        var height = jQuery(top_window).height(); // Account for padding
1712
1713        height -= parseInt($menu.css('padding-top'), 10); // and AdminBar
1714
1715        if ($menu.closest('.admin-bar').length > 0) {
1716          height -= 32;
1717        }
1718
1719        $menu.find('.et_pb_fullscreen_nav_container').css('max-height', height);
1720      }
1721    }
1722  }
1723
1724  $(window).unload(function () {
1725    /**
1726     * Fix the issue with Fullscreen menu, that remains open,
1727     * when back button is clicked in Firefox
1728     */
1729    if ($('body').hasClass('et_pb_fullscreen_menu_active')) {
1730      $('.et_toggle_fullscreen_menu').trigger('click');
1731    }
1732  });
1733  $('.et_pb_fullscreen_nav_container').on('click', 'li.menu-item-has-children > a', function () {
1734    var $this_parent = $(this).closest('li'),
1735        $this_arrow = $this_parent.find('>a .et_mobile_menu_arrow'),
1736        $closest_submenu = $this_parent.find('>ul'),
1737        is_opened_submenu = $this_arrow.hasClass('et_pb_submenu_opened'),
1738        sub_menu_max_height;
1739    $this_arrow.toggleClass('et_pb_submenu_opened');
1740
1741    if (is_opened_submenu) {
1742      $closest_submenu.removeClass('et_pb_slide_dropdown_opened');
1743      $closest_submenu.slideToggle(700, 'easeInOutCubic');
1744    } else {
1745      $closest_submenu.slideToggle(700, 'easeInOutCubic');
1746      $closest_submenu.addClass('et_pb_slide_dropdown_opened');
1747    }
1748
1749    return false;
1750  }); // define initial padding-top for fullscreen menu container
1751
1752  if ($('body').hasClass('et_header_style_fullscreen')) {
1753    var $menu_container = $('.et_header_style_fullscreen .et_slide_in_menu_container');
1754
1755    if ($menu_container.length) {
1756      var top_bar_height = $menu_container.find('.et_slide_menu_top').innerHeight();
1757      $menu_container.css({
1758        'padding-top': top_bar_height + 20
1759      });
1760    }
1761  } // adjust the scrolling position on Woocommerce checkout page in case of error
1762
1763
1764  $(document.body).on('checkout_error', function () {
1765    et_adjust_woocommerce_checkout_scroll();
1766  });
1767  $(document.body).on('updated_checkout', function (data) {
1768    if ('failure' !== data.result) {
1769      return;
1770    }
1771
1772    et_adjust_woocommerce_checkout_scroll();
1773  }); // Override row selector in VB
1774
1775  $et_window.on('et_fb_init', function () {
1776    var wp = top_window.wp;
1777
1778    if (wp && wp.hooks && wp.hooks.addFilter) {
1779      var replacement = window.DIVI.row_selector;
1780      wp.hooks.addFilter('et.pb.row.css.selector', 'divi.et.pb.row.css.selector', function (selector) {
1781        return selector.replace('%%row_selector%%', replacement);
1782      });
1783    }
1784  });
1785})(jQuery);
1786
1787/***/ })
1787
1788
1789/******/ });
1790//# sourceMappingURL=custom.js.map
1791//# sourceMappingURL=custom.js.map

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.