/*! ET custom.js */ (function($){ window.et_calculating_scroll_position = false; window.et_side_nav_links_initialized = false; var $et_pb_post_fullwidth = $( '.single.et_pb_pagebuilder_layout.et_full_width_page' ), et_is_mobile_device = navigator.userAgent.match( /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/ ), et_is_ipad = navigator.userAgent.match( /iPad/ ), $et_container = $( '.container' ), et_container_width = $et_container.width(), et_is_fixed_nav = $( 'body' ).hasClass( 'et_fixed_nav' ) || $( 'body' ).hasClass( 'et_vertical_fixed' ), et_is_vertical_fixed_nav = $( 'body' ).hasClass( 'et_vertical_fixed' ), et_is_rtl = $( 'body' ).hasClass( 'rtl' ), et_hide_nav = $( 'body' ).hasClass( 'et_hide_nav' ), et_header_style_left = $( 'body' ).hasClass( 'et_header_style_left' ), $top_header = $('#top-header'), $main_header = $('#main-header'), $main_container_wrapper = $( '#page-container' ), $et_main_content_first_row = $( '#main-content .container:first-child' ), $et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'), $et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find( 'h1.entry-title' ), $et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'), $et_single_post = $( 'body.single-post' ), $et_window = $(window), etRecalculateOffset = false, et_header_height, et_header_modifier, et_header_offset, et_primary_header_top, $et_header_style_split = $('.et_header_style_split'), $et_top_navigation = $('#et-top-navigation'), $logo = $('#logo'), $et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:visible:first' ), et_is_touch_device = 'ontouchstart' in window || navigator.maxTouchPoints; // We need to check first to see if we are on a woocommerce single product. if ( $("body").hasClass("woocommerce") && $("body").hasClass("single-product") && $(".woocommerce-product-gallery").length > 0 ) { // get the gallery container. var gal = $(".woocommerce-product-gallery")[0]; // let's replace the data attribute since Salvatorre reconfigures // data-columns on the resize event. var newstr = gal.outerHTML.replace( 'data-columns', 'data-cols' ); // finally we re-insert. gal.outerHTML = newstr; } $(document).ready( function(){ var $et_top_menu = $( 'ul.nav, ul.menu' ), $et_search_icon = $( '#et_search_icon' ), et_parent_menu_longpress_limit = 300, et_parent_menu_longpress_start, et_parent_menu_click = true; window.et_pb_init_nav_menu( $et_top_menu ); function et_header_menu_split(){ var $logo_container = $( '#main-header > .container > .logo_container' ), $logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'), et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(), et_top_navigation_li_break_index = Math.round( et_top_navigation_li_size / 2 ) - 1, window_width = $et_window.prop('outerWidth') || $et_window.width(); if ( window_width > 980 && $logo_container.length && $('body').hasClass('et_header_style_split') ) { $('
  • ').insertAfter($et_top_navigation.find('nav > ul >li:nth('+et_top_navigation_li_break_index+')') ); $logo_container.appendTo( $et_top_navigation.find('.centered-inline-logo-wrap') ); } if ( window_width <= 980 && $logo_container_splitted.length ) { $logo_container_splitted.prependTo('#main-header > .container'); $('#main-header .centered-inline-logo-wrap').remove(); } } function et_set_right_vertical_menu() { var $body = $( 'body' ); if ( $body.hasClass( 'et_boxed_layout' ) && $body.hasClass( 'et_vertical_fixed' ) && $body.hasClass( 'et_vertical_right' ) ) { var header_offset = parseFloat( $( '#page-container' ).css( 'margin-right' ) ); header_offset += ( parseFloat( $( '#et-main-area' ).css( 'margin-right' ) ) - 225 ); header_offset = 0 > header_offset ? 0 : header_offset; $( '#main-header' ).addClass( 'et_vertical_menu_set' ).css( { 'left': '', 'right': header_offset } ); } } if ( $et_header_style_split.length && ! window.et_is_vertical_nav ) { et_header_menu_split(); $(window).resize(function(){ et_header_menu_split(); }); } if ( $('ul.et_disable_top_tier').length ) { $("ul.et_disable_top_tier > li > ul").prev('a').attr('href','#'); } if ( window.et_is_vertical_nav ) { if ( $( '#main-header' ).height() < $( '#et-top-navigation' ).height() ) { $( '#main-header' ).height( $( '#et-top-navigation' ).height() + $( '#logo' ).height() + 100 ); } et_set_right_vertical_menu(); } window.et_calculate_header_values = function() { var $top_header = $( '#top-header' ), secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? parseInt( $top_header.innerHeight() ) : 0, admin_bar_height = $( '#wpadminbar' ).length ? parseInt( $( '#wpadminbar' ).innerHeight() ) : 0, $slide_menu_container = $( '.et_header_style_slide .et_slide_in_menu_container' ); et_header_height = parseInt( $( '#main-header' ).innerHeight() ) + secondary_nav_height; et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56; et_header_offset = et_header_modifier + admin_bar_height; et_primary_header_top = secondary_nav_height + admin_bar_height; if ( $slide_menu_container.length && ! $( 'body' ).hasClass( 'et_pb_slide_menu_active' ) ) { $slide_menu_container.css( { right: '-' + parseInt( $slide_menu_container.innerWidth() ) + 'px', 'display' : 'none' } ); if ( $( 'body' ).hasClass( 'et_boxed_layout' ) ) { var page_container_margin = $main_container_wrapper.css( 'margin-left' ); $main_header.css( { left : page_container_margin } ); } } }; var $comment_form = $('#commentform'); et_pb_form_placeholders_init( $comment_form ); $comment_form.submit(function(){ et_pb_remove_placeholder_text( $comment_form ); }); et_duplicate_menu( $('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu' ); et_duplicate_menu( '', $('.et_pb_fullscreen_nav_container'), 'mobile_menu_slide', 'et_mobile_menu', 'no_click_event' ); if ( $( '#et-secondary-nav' ).length ) { $('#et-top-navigation #mobile_menu').append( $( '#et-secondary-nav' ).clone().html() ); } // adding arrows for the slide/fullscreen menus if ( $( '.et_slide_in_menu_container' ).length ) { var $item_with_sub = $( '.et_slide_in_menu_container' ).find( '.menu-item-has-children > a' ); // add arrows for each menu item which has submenu if ( $item_with_sub.length ) { $item_with_sub.append( '' ); } } function et_change_primary_nav_position( delay ) { setTimeout( function() { var $body = $('body'), $wpadminbar = $( '#wpadminbar' ), $top_header = $( '#top-header' ), et_primary_header_top = 0; if ( $wpadminbar.length ) { et_primary_header_top += $wpadminbar.innerHeight(); } if ( $top_header.length && $top_header.is(':visible') ) { et_primary_header_top += $top_header.innerHeight(); } if ( ! window.et_is_vertical_nav && ( $body.hasClass( 'et_fixed_nav' ) ) ) { $('#main-header').css( 'top', et_primary_header_top ); } }, delay ); } function et_hide_nav_transofrm( ) { var $body = $( 'body' ), $body_height = $( document ).height(), $viewport_height = $( window ).height() + et_header_height + 200; if ( $body.hasClass( 'et_hide_nav' ) || $body.hasClass( 'et_hide_nav_disabled' ) && ( $body.hasClass( 'et_fixed_nav' ) ) ) { if ( $body_height > $viewport_height ) { if ( $body.hasClass( 'et_hide_nav_disabled' ) ) { $body.addClass( 'et_hide_nav' ); $body.removeClass( 'et_hide_nav_disabled' ); } $('#main-header').css( 'transform', 'translateY(-' + et_header_height +'px)' ); $('#top-header').css( 'transform', 'translateY(-' + et_header_height +'px)' ); } else { $('#main-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } ); $('#top-header').css( { 'transform': 'translateY(0)', 'opacity': '1' } ); $body.removeClass( 'et_hide_nav' ); $body.addClass( 'et_hide_nav_disabled' ); } } } // Saving current styling for the next resize cycle function et_save_initial_page_container_style( $selector, property ) { var styling = {}; styling[property] = $selector.css( property ); $selector.attr({ 'data-fix-page-container' : 'on' }).data({ 'fix_page_container_style' : styling }); } function et_page_load_scroll_to_anchor() { if ( $( window.et_location_hash ).length === 0 ) { return; } var $map_container = $( window.et_location_hash + ' .et_pb_map_container' ), $map = $map_container.children( '.et_pb_map' ), $target = $( window.et_location_hash ); // Make the target element visible again $target.css( 'display', window.et_location_hash_style ); var distance = ( 'undefined' !== typeof( $target.offset().top ) ) ? $target.offset().top : 0, speed = ( distance > 4000 ) ? 1600 : 800; if ( $map_container.length ) { google.maps.event.trigger( $map[0], 'resize' ); } // Allow the header sizing functions enough time to finish before scrolling the page setTimeout( function() { et_pb_smooth_scroll( $target, false, speed, 'swing'); // During the page scroll animation, the header's height might change. // Do the scroll animation again to ensure its accuracy. setTimeout( function() { et_pb_smooth_scroll( $target, false, 150, 'linear' ); }, speed + 25 ); }, 700 ); } // Retrieving padding/margin value based on formatted saved padding/margin strings function et_get_saved_padding_margin_value( saved_value, order ) { if ( typeof saved_value === 'undefined' ) { return false; } var values = saved_value.split('|'); return typeof values[order] !== 'undefined' ? values[order] : false; } function et_fix_page_container_position(){ var et_window_width = parseInt( $et_window.width() ), $top_header = $( '#top-header' ), $et_pb_first_row = $( 'body.et_pb_pagebuilder_layout .et_pb_section:visible:first' ), secondary_nav_height = $top_header.length && $top_header.is( ':visible' ) ? parseInt( $top_header.innerHeight() ) : 0, main_header_fixed_height = 0, header_height; // Replace previous resize cycle's adjustment $('*[data-fix-page-container="on"]').each(function(){ var $adjusted_element = $(this), styling = $adjusted_element.data(); // Reapply previous styling $adjusted_element.css( styling.fix_page_container_style ); }); // Set data-height-onload for header if the page is loaded on large screen // If the page is loaded from small screen, rely on data-height-onload printed on the markup, // prevent window resizing issue from small to large if ( et_window_width > 980 && ! $main_header.attr( 'data-height-loaded' ) ){ $main_header.attr({ 'data-height-onload' : parseInt( $main_header.height() ), 'data-height-loaded' : true }); } // Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below) if ( et_window_width <= 980 ) { header_height = parseInt( $main_header.innerHeight() ) + secondary_nav_height - 1; // If transparent is detected, #main-content .container's padding-top needs to be added to header_height // And NOT a pagebuilder page if ( window.et_is_transparent_nav && ! $et_pb_first_row.length ) { header_height += 58; } } else { // Get header height from header attribute 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 if ( window.et_is_transparent_nav && ! window.et_is_vertical_nav && $et_main_content_first_row.length ) { header_height += 58; } // Calculate fixed header height by cloning, emulating, and calculating its height $main_header.clone().addClass( 'main-header-clone et-fixed-header' ).css({ opacity: 0, position: 'fixed', top: 'auto', right: 0, bottom: 0, left: 0 }).appendTo( $('body') ); main_header_fixed_height = $('.main-header-clone').height(); $('.main-header-clone').remove(); } // Saved fixed main header height calculation $main_header.attr({ 'data-fixed-height-onload': main_header_fixed_height }); // Specific adjustment required for transparent nav + not vertical nav if ( window.et_is_transparent_nav && ! window.et_is_vertical_nav ){ // Add class for first row for custom section padding purpose $et_pb_first_row.addClass( 'et_pb_section_first' ); // List of conditionals var is_pb = $et_pb_first_row.length, is_post_pb = is_pb && $et_single_post.length, is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length, is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length, is_pb_fullwidth_section_first = $et_pb_first_row.is( '.et_pb_fullwidth_section' ), is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length; if ( is_post_pb && ! ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first ) ) { /* Desktop / Mobile + Single Post */ /* * EXCEPT for fullwidth layout + fullwidth section ( at the first row ). * It is basically the same as page + fullwidth section with few quirk. * Instead of duplicating the conditional for each module, it'll be simpler to negate * fullwidth layout + fullwidth section in is_post_pb and rely it to is_pb_fullwidth_section_first */ // Remove main content's inline padding to styling to prevent looping padding-top calculation $et_main_content_first_row.css({ 'paddingTop' : '' }); if ( et_window_width < 980 ) { header_height += 40; } if ( is_pb_fullwidth_section_first ) { // If the first section is fullwidth, restore the padding-top modified area at first section $et_pb_first_row.css({ 'paddingTop' : '0' }); } if ( is_post_pb_full_layout_has_title ) { // Add header height to post meta wrapper as padding top $et_main_content_first_row_meta_wrapper.css({ 'paddingTop' : header_height }); } else if ( is_post_pb_full_layout_no_title ) { // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_pb_first_row, 'paddingTop' ); $et_pb_first_row.css({ 'paddingTop' : header_height }); } else { // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_main_content_first_row, 'paddingTop' ); // Add header height to first row content as padding top $et_main_content_first_row.css({ 'paddingTop' : header_height }); } } else if ( is_pb_fullwidth_section_first ){ /* Desktop / Mobile + Pagebuilder + Fullwidth Section */ 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, // Remove the added height at line 2656 if ( is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first && et_window_width > 980 ) { header_height = header_height - 58; } if ( $et_pb_first_row_first_module.is( '.et_pb_slider' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth slider */ var $et_pb_first_row_first_module_slide_image = $et_pb_first_row_first_module.find( '.et_pb_slide_image' ), $et_pb_first_row_first_module_slide = $et_pb_first_row_first_module.find( '.et_pb_slide' ), $et_pb_first_row_first_module_slide_container = $et_pb_first_row_first_module.find( '.et_pb_slide .et_pb_container' ), et_pb_slide_image_margin_top = 0 - ( parseInt( $et_pb_first_row_first_module_slide_image.height() ) / 2 ), et_pb_slide_container_height = 0, $et_pb_first_row_first_module_slider_arrow = $et_pb_first_row_first_module.find( '.et-pb-slider-arrows a'), et_pb_first_row_slider_arrow_height = $et_pb_first_row_first_module_slider_arrow.height(); // Save current styling for the next resize cycle 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 $et_pb_first_row_first_module_slide.css({ 'paddingTop' : header_height }); // delete container's min-height $et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' }); // Save current styling for the next resize cycle 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 $et_pb_first_row_first_module_slide_image.css({ 'marginTop' : et_pb_slide_image_margin_top }); // Save current styling for the next resize cycle 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 $et_pb_first_row_first_module_slider_arrow.css({ 'marginTop' : ( ( header_height / 2 ) - ( et_pb_first_row_slider_arrow_height / 2 ) ) }); // Looping the slide and get the highest height of slide var et_pb_first_row_slide_container_height_new = 0; $et_pb_first_row_first_module.find( '.et_pb_slide' ).each( function(){ var $et_pb_first_row_first_module_slide_item = $(this), $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 $et_pb_first_row_first_module_slide_item.show(); // Remove existing inline css to make sure that it calculates the height $et_pb_first_row_first_module_slide_container.css({ 'min-height' : '' }); var et_pb_first_row_slide_container_height = $et_pb_first_row_first_module_slide_container.innerHeight(); if ( et_pb_first_row_slide_container_height_new < et_pb_first_row_slide_container_height ){ et_pb_first_row_slide_container_height_new = et_pb_first_row_slide_container_height; } // Hide the slide back if it isn't active slide if ( $et_pb_first_row_first_module_slide_item.is( ':not(".et-pb-active-slide")' ) ){ $et_pb_first_row_first_module_slide_item.hide(); } }); // Save current styling for the next resize cycle 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 $et_pb_first_row_first_module_slide_container.css({ 'min-height' : et_pb_first_row_slide_container_height_new }); } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_header' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth header */ // Remove existing inline stylesheet to prevent looping padding $et_pb_first_row_first_module.removeAttr( 'style' ); // Get paddingTop from stylesheet 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 et_save_initial_page_container_style( $et_pb_first_row_first_module, 'paddingTop' ); // Implement stylesheet's padding-top + header_height $et_pb_first_row_first_module.css({ 'paddingTop' : ( header_height + et_pb_first_row_first_module_fullwidth_header_padding_top ) } ); } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_portfolio' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth Portfolio */ // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_pb_first_row_first_module, 'paddingTop' ); $et_pb_first_row_first_module.css({ 'paddingTop' : header_height }); } else if ( $et_pb_first_row_first_module.is( '.et_pb_map_container' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth Map */ 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 $et_pb_first_row_map.css({ 'height' : '' }); // Implement map height + header height $et_pb_first_row_first_module.find('.et_pb_map').css({ 'height' : header_height + parseInt( $et_pb_first_row_map.css( 'height' ) ) }); // Adding specific class to mark the map as first row section element $et_pb_first_row_first_module.addClass( 'et_beneath_transparent_nav' ); } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_menu' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth Menu */ // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_pb_first_row_first_module, 'marginTop' ); $et_pb_first_row_first_module.css({ 'marginTop' : header_height }); } else if ( $et_pb_first_row_first_module.is( '.et_pb_fullwidth_code' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth code */ var $et_pb_first_row_first_module_code = $et_pb_first_row_first_module; $et_pb_first_row_first_module_code.css({ 'paddingTop' : '' }); 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 et_save_initial_page_container_style( $et_pb_first_row_first_module_code, 'paddingTop' ); $et_pb_first_row_first_module_code.css({ 'paddingTop' : header_height + et_pb_first_row_first_module_code_padding_top }); } else if ( $et_pb_first_row_first_module.is( '.et_pb_post_title' ) ) { /* Desktop / Mobile + Pagebuilder + Fullwidth Post Title */ var $et_pb_first_row_first_module_title = $et_pb_first_row_first_module; // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_pb_first_row_first_module_title, 'paddingTop' ); $et_pb_first_row_first_module.css({ 'paddingTop' : header_height + 50 }); } } else if ( is_pb ) { /* Desktop / Mobile + Pagebuilder + Regular section */ // Remove first row's inline padding top styling to prevent looping padding-top calculation $et_pb_first_row.css({ 'paddingTop' : '' }); // Get saved custom padding from data-* attributes. Builder automatically adds // saved custom paddings to data-* attributes on first section var saved_custom_padding = $et_pb_first_row.attr('data-padding'), saved_custom_padding_top = et_get_saved_padding_margin_value( saved_custom_padding, 0 ), saved_custom_padding_tablet = $et_pb_first_row.attr('data-padding-tablet'), saved_custom_padding_tablet_top = et_get_saved_padding_margin_value( saved_custom_padding_tablet, 0 ), saved_custom_padding_phone = $et_pb_first_row.attr('data-padding-phone'), saved_custom_padding_phone_top = et_get_saved_padding_margin_value( saved_custom_padding_phone, 0 ), applied_saved_custom_padding; if ( saved_custom_padding_top || saved_custom_padding_tablet_top || saved_custom_padding_phone_top ) { // Applies padding top to first section to automatically convert saved unit into px if ( et_window_width > 980 && saved_custom_padding_top ) { $et_pb_first_row.css({ paddingTop: saved_custom_padding_top }); } else if ( et_window_width > 767 && saved_custom_padding_tablet_top ) { $et_pb_first_row.css({ paddingTop: saved_custom_padding_tablet_top }); } else if ( saved_custom_padding_phone_top ) { $et_pb_first_row.css({ paddingTop: saved_custom_padding_phone_top }); } // Get converted custom padding top value applied_saved_custom_padding = parseInt( $et_pb_first_row.css( 'paddingTop' ) ); // Implemented saved & converted padding top + header height $et_pb_first_row.css({ paddingTop: ( header_height + applied_saved_custom_padding ) }); } else { // Pagebuilder ignores #main-content .container's fixed height and uses its row's padding // Anticipate the use of custom section padding. et_pb_first_row_padding_top = header_height + parseInt( $et_pb_first_row.css( 'paddingBottom' ) ); // Save current styling for the next resize cycle et_save_initial_page_container_style( $et_pb_first_row, 'paddingTop' ); // Implementing padding-top + header_height $et_pb_first_row.css({ 'paddingTop' : et_pb_first_row_padding_top }); } } else if ( is_no_pb_mobile ) { // Mobile + not pagebuilder $et_main_content_first_row.css({ 'paddingTop' : header_height }); } else { $('#main-content .container:first-child').css({ 'paddingTop' : header_height }); } // Set #page-container's padding-top to zero after inline styling first row's content has been added if ( ! $('#et_fix_page_container_position').length ){ $( '