if (!$waypoint_selector.length) {
$waypoint_selector = et_get_first_module();
} else if (isFirstRowOnTop && window.et_is_transparent_nav && !window.et_is_vertical_nav && $et_main_content_first_row.length) {
$waypoint_selector = $('#content-area');
$waypoint_selector = $('#main-content');
} // Disabled section/row/module can cause waypoint to trigger 'down' event during its setup even if
// no scrolling happened, which would result in 'et-fixed-header' class being prematurely added.
// Since this only happens when page is loaded, we add an extra check that is no longer needed
// as soon as waypoint initialization is finished.
var checkIfScrolled = true;
$waypoint_selector.waypoint({
offset: function offset() {
if (etRecalculateOffset) {
et_calculate_header_values();
etRecalculateOffset = false;
return et_header_offset - et_header_height - 200;
// Transparent nav modification: #page-container's offset is set to 0. Modify et_header_offset's according to header height
var waypoint_selector_offset = $waypoint_selector.offset();
if (waypoint_selector_offset.top < et_header_offset) {
et_header_offset = 0 - (et_header_offset - waypoint_selector_offset.top);
handler: function handler(direction) {
et_fix_logo_transition();
if (direction === 'down') {
if (checkIfScrolled && $et_window.scrollTop() === 0) {
$main_header.addClass('et-fixed-header');
$main_container_wrapper.addClass('et-animated-content');
$top_header.addClass('et-fixed-header');
if (!et_hide_nav && !window.et_is_transparent_nav && !$('.mobile_menu_bar_toggle').is(':visible')) {
var secondary_nav_height = $top_header.length ? parseInt($top_header.height()) : 0,
$clone_header = $main_header.clone().addClass('et-fixed-header, et_header_clone').css({
clone_header_height = parseInt($clone_header.prependTo('body').height()); // Vertical nav doesn't need #page-container margin-top adjustment
if (!window.et_is_vertical_nav) {
fix_padding = parseInt($main_container_wrapper.css('padding-top')) - clone_header_height - secondary_nav_height + 1;
$main_container_wrapper.css('margin-top', -fix_padding);
$('.et_header_clone').remove();
$main_header.removeClass('et-fixed-header');
$top_header.removeClass('et-fixed-header');
$main_container_wrapper.css('margin-top', -fix_padding);
} // Dispatch event when fixed header height transition starts
window.dispatchEvent(new CustomEvent('ETDiviFixedHeaderTransitionStart', {
et_set_search_form_css(); // Dispatch another event when fixed header height transition ends
window.dispatchEvent(new CustomEvent('ETDiviFixedHeaderTransitionEnd', {
$('a[href*="#"]:not([href="#"]), .mobile_nav').on('click', function (e) {
var $this_link = $(this),
has_closest_smooth_scroll_disabled = $this_link.closest('.et_smooth_scroll_disabled').length,
has_closest_woocommerce_tabs = $this_link.closest('.woocommerce-tabs').length && $this_link.closest('.tabs').length,
has_closest_timetable_tab = $this_link.closest('.tt_tabs_navigation').length,
has_closest_eab_cal_link = $this_link.closest('.eab-shortcode_calendar-navigation-link').length,
has_closest_ee_cart_link = $this_link.closest('.view-cart-lnk').length,
has_acomment_reply = $this_link.hasClass('acomment-reply'),
is_woocommerce_review_link = $this_link.hasClass('woocommerce-review-link'),
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;
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname && !disable_scroll) {
var target = $(this.hash); // Workaround for empty target in mobile menu.
if ($this_link.hasClass('mobile_nav')) {
target = $('#' + e.target.hash.slice(1));
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
// Workaround for reviews tab in woo tabs.
if ($(this).parents().hasClass('widget_recent_reviews')) {
$('.reviews_tab').click().animate({
scrollTop: target.offset().top
} // automatically close fullscreen menu if clicked from there
if ($this_link.closest('.et_pb_fullscreen_menu_opened').length > 0) {
et_pb_toggle_fullscreen_menu();
et_pb_smooth_scroll(target, false, 800);
if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && $(window).width() > 980) {
et_pb_smooth_scroll(target, false, 40, 'linear');
}); // Marking elements which has attached event already
$('a[href*="#"]:not([href="#"])').each(function (index, element) {
$(element).attr('data-et-has-event-already', 'true');
var et_pb_window_side_nav_get_sections = function et_pb_window_side_nav_get_sections() {
var $postRoot = $('.et-l--post');
var $inTBBody = $('.et-l--body .et_pb_section').not('.et-l--post .et_pb_section');
if (builder_scripts_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isBuilder"]) {
$inPost = $postRoot.find('.et-fb-post-content > .et_pb_section');
$inPost = $postRoot.find('.et_builder_inner_content > .et_pb_section');
if (0 === $inTBBody.length || $inPost.length > 1) {
window.et_pb_window_side_nav_scroll_init = function () {
if (true === window.et_calculating_scroll_position || false === window.et_side_nav_links_initialized) {
var $sections = et_pb_window_side_nav_get_sections();
window.et_calculating_scroll_position = true;
var is_tb_layout_used = $('.et-l--header').length || $('.et-l--body').length || !$('#main-header').length;
var add_offset_default = is_tb_layout_used ? 0 : -90;
var add_offset = $('body').hasClass('et_fixed_nav') ? 20 : add_offset_default;
var top_header_height = $('#top-header').length > 0 ? parseInt($('#top-header').height()) : 0;
var main_header_height = $('#main-header').length > 0 ? parseInt($('#main-header').height()) : 0;
if ($('#wpadminbar').length > 0 && parseInt($(window).width()) > 600) {
add_offset += parseInt($('#wpadminbar').outerHeight());
if (window.et_is_vertical_nav) {
side_offset = top_header_height + add_offset + 60;
side_offset = top_header_height + main_header_height + add_offset;
var window_height = parseInt($(window).height());
var scroll_position = parseInt($(window).scrollTop());
var document_height = parseInt($(document).height());
var at_bottom_of_page = window_height + scroll_position === document_height;
var total_links = $('.side_nav_item a').length - 1;
for (var link = 0; link <= total_links; link++) {
var $target_section = $sections.eq(link);
var at_top_of_page = 'undefined' === typeof $target_section.offset();
var current_active = $('.side_nav_item a.active').parent().index();
var target_offset = false === at_top_of_page ? $target_section.offset().top - side_offset : 0;
} else if (at_bottom_of_page) {
next_active = total_links;
} else if (scroll_position >= target_offset) {
if (null !== next_active && next_active !== current_active) {
$('.side_nav_item a').removeClass('active');
$('a#side_nav_item_id_' + next_active).addClass('active');
window.et_calculating_scroll_position = false;
window.et_pb_side_nav_page_init = function () {
var $sections = et_pb_window_side_nav_get_sections();
var total_sections = $sections.length;
var side_nav_offset = parseInt((total_sections * 20 + 40) / 2);
window.et_side_nav_links_initialized = false;
window.et_calculating_scroll_position = false;
if (total_sections > 1 && $('.et_pb_side_nav_page').length) {
$('#main-content').append('<ul class="et_pb_side_nav"></ul>');
$sections.each(function (index, element) {
var active_class = 0 === index ? 'active' : '';
$('.et_pb_side_nav').append('<li class="side_nav_item"><a href="#" id="side_nav_item_id_' + index + '" class= "' + active_class + '">' + index + '</a></li>');
if (total_sections - 1 === index) {
window.et_side_nav_links_initialized = true;
$('ul.et_pb_side_nav').css('marginTop', '-' + side_nav_offset + 'px');
$('.et_pb_side_nav').addClass('et-visible');
$('.et_pb_side_nav a').click(function () {
// We use the index position of the sections to locate them instead of custom classes so
// that we have the same implementation for the frontend website and the Visual Builder.
var index = parseInt($(this).text());
var $target = $sections.eq(index);
var top_section = $(this).text() == "0" && !$('.et-l--body').length;
et_pb_smooth_scroll($target, top_section, 800);
if (!$('#main-header').hasClass('et-fixed-header') && $('body').hasClass('et_fixed_nav') && parseInt($(window).width()) > 980) {
et_pb_smooth_scroll($target, top_section, 200);
$(window).on('scroll', et_pb_window_side_nav_scroll_init);
if ($('body').is('.et-fb, .et-bfb')) {
// Debounce slow function
window.et_pb_side_nav_page_init = et_debounce(window.et_pb_side_nav_page_init, 200);
et_pb_side_nav_page_init();
if ($('.et_pb_scroll_top').length) {
$(window).scroll(function () {
if ($(this).scrollTop() > 800) {
$('.et_pb_scroll_top').show().removeClass('et-hidden').addClass('et-visible');
$('.et_pb_scroll_top').removeClass('et-visible').addClass('et-hidden');
}); //Click event to scroll to top
$('.et_pb_scroll_top').click(function () {
$('html, body').animate({
if ($('.comment-reply-link').length) {
$('.comment-reply-link').addClass('et_pb_button');
$('#et_top_search').click(function () {
var $search_container = $('.et_search_form_container');
if ($search_container.hasClass('et_pb_is_animating')) {
$('.et_menu_container').removeClass('et_pb_menu_visible et_pb_no_animation').addClass('et_pb_menu_hidden');
$search_container.removeClass('et_pb_search_form_hidden et_pb_no_animation').addClass('et_pb_search_visible et_pb_is_animating');
$('.et_menu_container').addClass('et_pb_no_animation');
$search_container.addClass('et_pb_no_animation').removeClass('et_pb_is_animating');
$search_container.find('input').focus();
et_set_search_form_css();
function et_hide_search() {
if ($('.et_search_form_container').hasClass('et_pb_is_animating')) {
$('.et_menu_container').removeClass('et_pb_menu_hidden et_pb_no_animation').addClass('et_pb_menu_visible');
$('.et_search_form_container').removeClass('et_pb_search_visible et_pb_no_animation').addClass('et_pb_search_form_hidden et_pb_is_animating');
$('.et_menu_container').addClass('et_pb_no_animation');
$('.et_search_form_container').addClass('et_pb_no_animation').removeClass('et_pb_is_animating');
function et_set_search_form_css() {
var $search_container = $('.et_search_form_container');
if ($search_container.hasClass('et_pb_search_visible')) {
var header_height = $('#main-header').innerHeight(),
menu_width = $('#top-menu').width(),
font_size = $('#top-menu li a').css('font-size');
'height': header_height + 'px'
$search_container.find('input').css('font-size', font_size);
if (!$body.hasClass('et_header_style_left')) {
$search_container.css('max-width', menu_width + 60);
$search_container.find('form').css('max-width', menu_width + 60);
$('.et_close_search_field').click(function () {
$(document).mouseup(function (e) {
var $header = $('#main-header');
if ($('.et_menu_container').hasClass('et_pb_menu_hidden')) {
if (!$header.is(e.target) && $header.has(e.target).length === 0) {
}); // Detect actual logo dimension, used for tricky fixed navigation transition
function et_define_logo_dimension() {
logo_src = $logo.attr('src'),
is_svg = logo_src.substr(-3, 3) === 'svg' ? true : false,
logo_height; // Append invisible wrapper at the bottom of the page
$('body').append($('<div />', {
'id': 'et-define-logo-wrap',
'style': 'position: fixed; bottom: 0; opacity: 0;'
$logo_wrap = $('#et-define-logo-wrap');
$logo_wrap.addClass('svg-logo');
} // Clone logo to invisible wrapper
$logo_wrap.html($logo.clone().css({
}).removeAttr('id')); // Get dimension
logo_width = $logo_wrap.find('img').width();
logo_height = $logo_wrap.find('img').height(); // Add data attribute to $logo
'data-actual-width': logo_width,
'data-actual-height': logo_height
}); // Destroy invisible wrapper
$logo_wrap.remove(); // Init logo transition onload
et_fix_logo_transition(true);
// Wait until logo is loaded before performing logo dimension fix
// This comes handy when the page is heavy due to the use of images or other assets
et_preload_image($('#logo').attr('src'), et_define_logo_dimension);
} // Set width for adsense in footer widget
$('.footer-widget').each(function () {
var $footer_widget = $(this),
footer_widget_width = $footer_widget.width(),
$adsense_ins = $footer_widget.find('.widget_adsensewidget ins');
if ($adsense_ins.length) {
$adsense_ins.width(footer_widget_width);
* Visual Builder adjustment
function et_fb_side_nav_page_init() {
$(window).off('scroll', window.et_pb_window_side_nav_scroll_init);
$('#main-content .et_pb_side_nav').off('click', '.et_pb_side_nav a');
$('#main-content .et_pb_side_nav').remove();
et_pb_side_nav_page_init();
if ($('body').is('.et-fb')) {
$(window).on('et_fb_root_did_mount', function () {
et_fb_side_nav_page_init();
et_all_elements_loaded();
$(window).on('et_fb_section_content_change', et_fb_side_nav_page_init);
window.addEventListener('load', et_all_elements_loaded);
}); // Fixing logo size transition in tricky header style
function et_fix_logo_transition(is_onload) {
logo_actual_width = parseInt($logo.attr('data-actual-width')),
logo_actual_height = parseInt($logo.attr('data-actual-height')),
logo_height_percentage = parseInt($logo.attr('data-height-percentage')),
$top_nav = $('#et-top-navigation'),
top_nav_height = parseInt($top_nav.attr('data-height')),
top_nav_fixed_height = parseInt($top_nav.attr('data-fixed-height')),
$main_header = $('#main-header'),
is_header_split = $body.hasClass('et_header_style_split'),
is_fixed_nav = $main_header.hasClass('et-fixed-header'),
is_hide_primary_logo = $body.hasClass('et_hide_primary_logo'),
is_hide_fixed_logo = $body.hasClass('et_hide_fixed_logo'),
logo_height_base = is_fixed_nav ? top_nav_height : top_nav_fixed_height,
is_onload = typeof is_onload === 'undefined' ? false : is_onload; // Fix for inline centered logo in horizontal nav
if (is_header_split && !window.et_is_vertical_nav) {
// On page load, logo_height_base should be top_nav_height
logo_height_base = top_nav_height;
} // Calculate logo wrapper height
logo_wrapper_height = logo_height_base * (logo_height_percentage / 100) + 22; // Calculate logo wrapper width
logo_wrapper_width = logo_actual_width * (logo_wrapper_height / logo_actual_height); // Override logo wrapper width to 0 if it is hidden
if (is_hide_primary_logo && (is_fixed_nav || is_onload)) {
if (is_hide_fixed_logo && !is_fixed_nav && !is_onload) {
} // Set fixed width for logo wrapper to force correct dimension
$('.et_header_style_split .centered-inline-logo-wrap').css({
'width': logo_wrapper_width
function et_toggle_slide_menu(force_state) {
var $slide_menu_container = $('.et_header_style_slide .et_slide_in_menu_container'),
$page_container = $('.et_header_style_slide #page-container, .et_header_style_slide.et_fixed_nav #main-header'),
$header_container = $('.et_header_style_slide #main-header'),
is_menu_opened = $slide_menu_container.hasClass('et_pb_slide_menu_opened'),
set_to = typeof force_state !== 'undefined' ? force_state : 'auto',
is_boxed_layout = $('body').hasClass('et_boxed_layout'),
page_container_margin = is_boxed_layout ? parseFloat($('#page-container').css('margin-left')) : 0,
slide_container_width = $slide_menu_container.innerWidth(),
is_rtl = $('body').hasClass('rtl');
if ('auto' !== set_to && (is_menu_opened && 'open' === set_to || !is_menu_opened && 'close' === set_to)) {
$slide_menu_container.css({
left: '-' + slide_container_width + 'px'