Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/js
File: custom.js
et_is_ipad = navigator.userAgent.match(/iPad/),
[3500] Fix | Delete
$et_container = $('.container'),
[3501] Fix | Delete
et_container_width = $et_container.width(),
[3502] Fix | Delete
et_is_fixed_nav = $('body').hasClass('et_fixed_nav') || $('body').hasClass('et_vertical_fixed'),
[3503] Fix | Delete
et_is_vertical_fixed_nav = $('body').hasClass('et_vertical_fixed'),
[3504] Fix | Delete
et_is_rtl = $('body').hasClass('rtl'),
[3505] Fix | Delete
et_hide_nav = $('body').hasClass('et_hide_nav'),
[3506] Fix | Delete
et_header_style_left = $('body').hasClass('et_header_style_left'),
[3507] Fix | Delete
$top_header = $('#top-header'),
[3508] Fix | Delete
$main_header = $('#main-header'),
[3509] Fix | Delete
$main_container_wrapper = $('#page-container'),
[3510] Fix | Delete
$et_main_content_first_row = $('#main-content .container:first-child'),
[3511] Fix | Delete
$et_main_content_first_row_meta_wrapper = $et_main_content_first_row.find('.et_post_meta_wrapper:first'),
[3512] Fix | Delete
$et_main_content_first_row_meta_wrapper_title = $et_main_content_first_row_meta_wrapper.find('h1.entry-title'),
[3513] Fix | Delete
$et_main_content_first_row_content = $et_main_content_first_row.find('.entry-content:first'),
[3514] Fix | Delete
$et_single_post = $('body.single'),
[3515] Fix | Delete
$et_window = $(window),
[3516] Fix | Delete
etRecalculateOffset = false,
[3517] Fix | Delete
et_header_height = 0,
[3518] Fix | Delete
et_header_modifier,
[3519] Fix | Delete
et_header_offset,
[3520] Fix | Delete
et_primary_header_top,
[3521] Fix | Delete
$et_header_style_split = $('.et_header_style_split'),
[3522] Fix | Delete
$et_top_navigation = $('#et-top-navigation'),
[3523] Fix | Delete
$logo = $('#logo'),
[3524] Fix | Delete
$et_pb_first_row = et_get_first_section(),
[3525] Fix | Delete
et_is_touch_device = 'ontouchstart' in window || navigator.maxTouchPoints,
[3526] Fix | Delete
$et_top_cart = $('#et-secondary-menu a.et-cart-info'); // Modification of underscore's _.debounce()
[3527] Fix | Delete
// Underscore.js 1.8.3
[3528] Fix | Delete
// http://underscorejs.org
[3529] Fix | Delete
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
[3530] Fix | Delete
// Underscore may be freely distributed under the MIT license.
[3531] Fix | Delete
[3532] Fix | Delete
function et_debounce(func, wait, immediate) {
[3533] Fix | Delete
var timeout, args, context, timestamp, result;
[3534] Fix | Delete
var now = Date.now || new Date().getTime();
[3535] Fix | Delete
[3536] Fix | Delete
var later = function later() {
[3537] Fix | Delete
var last = now - timestamp;
[3538] Fix | Delete
[3539] Fix | Delete
if (last < wait && last >= 0) {
[3540] Fix | Delete
timeout = setTimeout(later, wait - last);
[3541] Fix | Delete
} else {
[3542] Fix | Delete
timeout = null;
[3543] Fix | Delete
[3544] Fix | Delete
if (!immediate) {
[3545] Fix | Delete
result = func.apply(context, args);
[3546] Fix | Delete
if (!timeout) context = args = null;
[3547] Fix | Delete
}
[3548] Fix | Delete
}
[3549] Fix | Delete
};
[3550] Fix | Delete
[3551] Fix | Delete
return function () {
[3552] Fix | Delete
context = this;
[3553] Fix | Delete
args = arguments;
[3554] Fix | Delete
timestamp = now;
[3555] Fix | Delete
var callNow = immediate && !timeout;
[3556] Fix | Delete
if (!timeout) timeout = setTimeout(later, wait);
[3557] Fix | Delete
[3558] Fix | Delete
if (callNow) {
[3559] Fix | Delete
result = func.apply(context, args);
[3560] Fix | Delete
context = args = null;
[3561] Fix | Delete
}
[3562] Fix | Delete
[3563] Fix | Delete
return result;
[3564] Fix | Delete
};
[3565] Fix | Delete
}
[3566] Fix | Delete
[3567] Fix | Delete
;
[3568] Fix | Delete
[3569] Fix | Delete
function et_preload_image(src, callback) {
[3570] Fix | Delete
var img = new Image();
[3571] Fix | Delete
img.onLoad = callback;
[3572] Fix | Delete
img.onload = callback;
[3573] Fix | Delete
img.src = src;
[3574] Fix | Delete
} // We need to check first to see if we are on a woocommerce single product.
[3575] Fix | Delete
[3576] Fix | Delete
[3577] Fix | Delete
if ($(".woocommerce .woocommerce-product-gallery").length > 0) {
[3578] Fix | Delete
// get the gallery container.
[3579] Fix | Delete
var gal = $(".woocommerce-product-gallery")[0]; // let's replace the data attribute since Salvatorre reconfigures
[3580] Fix | Delete
// data-columns on the resize event.
[3581] Fix | Delete
[3582] Fix | Delete
var newstr = gal.outerHTML.replace('data-columns', 'data-cols'); // finally we re-insert.
[3583] Fix | Delete
[3584] Fix | Delete
gal.outerHTML = newstr;
[3585] Fix | Delete
} // update the cart item on the secondary menu.
[3586] Fix | Delete
[3587] Fix | Delete
[3588] Fix | Delete
if ($et_top_cart.length > 0 && $('.shop_table.cart').length > 0) {
[3589] Fix | Delete
$(document.body).on('updated_wc_div', function () {
[3590] Fix | Delete
var new_total = 0;
[3591] Fix | Delete
var new_text;
[3592] Fix | Delete
$('.shop_table.cart').find('.product-quantity input').each(function () {
[3593] Fix | Delete
new_total = new_total + parseInt($(this).val());
[3594] Fix | Delete
});
[3595] Fix | Delete
[3596] Fix | Delete
if (new_total === 1) {
[3597] Fix | Delete
new_text = DIVI.item_count;
[3598] Fix | Delete
} else {
[3599] Fix | Delete
new_text = DIVI.items_count;
[3600] Fix | Delete
}
[3601] Fix | Delete
[3602] Fix | Delete
new_text = new_text.replace('%d', new_total);
[3603] Fix | Delete
$et_top_cart.find('span').text(new_text);
[3604] Fix | Delete
});
[3605] Fix | Delete
}
[3606] Fix | Delete
[3607] Fix | Delete
document.addEventListener('DOMContentLoaded', function () {
[3608] Fix | Delete
var $et_top_menu = $('ul.nav, ul.menu'),
[3609] Fix | Delete
$et_search_icon = $('#et_search_icon'),
[3610] Fix | Delete
et_parent_menu_longpress_limit = 300,
[3611] Fix | Delete
et_parent_menu_longpress_start,
[3612] Fix | Delete
et_parent_menu_click = true,
[3613] Fix | Delete
is_customize_preview = $('body').hasClass('et_is_customize_preview');
[3614] Fix | Delete
window.et_pb_init_nav_menu($et_top_menu);
[3615] Fix | Delete
[3616] Fix | Delete
function et_header_menu_split() {
[3617] Fix | Delete
var $logo_container = $('#main-header > .container > .logo_container'),
[3618] Fix | Delete
$logo_container_splitted = $('.centered-inline-logo-wrap > .logo_container'),
[3619] Fix | Delete
et_top_navigation_li_size = $et_top_navigation.children('nav').children('ul').children('li').size(),
[3620] Fix | Delete
et_top_navigation_li_break_index = Math.round(et_top_navigation_li_size / 2) - 1,
[3621] Fix | Delete
window_width = window.innerWidth || $et_window.width();
[3622] Fix | Delete
[3623] Fix | Delete
if (window_width > 980 && $logo_container.length && $('body').hasClass('et_header_style_split')) {
[3624] Fix | Delete
$('<li class="centered-inline-logo-wrap"></li>').insertAfter($et_top_navigation.find('nav > ul >li:nth(' + et_top_navigation_li_break_index + ')'));
[3625] Fix | Delete
$logo_container.appendTo($et_top_navigation.find('.centered-inline-logo-wrap'));
[3626] Fix | Delete
}
[3627] Fix | Delete
[3628] Fix | Delete
if (window_width <= 980 && $logo_container_splitted.length) {
[3629] Fix | Delete
$logo_container_splitted.prependTo('#main-header > .container');
[3630] Fix | Delete
$('#main-header .centered-inline-logo-wrap').remove();
[3631] Fix | Delete
}
[3632] Fix | Delete
}
[3633] Fix | Delete
[3634] Fix | Delete
function et_set_right_vertical_menu() {
[3635] Fix | Delete
var $body = $('body');
[3636] Fix | Delete
[3637] Fix | Delete
if ($body.hasClass('et_boxed_layout') && $body.hasClass('et_vertical_fixed') && $body.hasClass('et_vertical_right')) {
[3638] Fix | Delete
var header_offset = parseFloat($('#page-container').css('margin-right'));
[3639] Fix | Delete
header_offset += parseFloat($('#et-main-area').css('margin-right')) - 225;
[3640] Fix | Delete
header_offset = 0 > header_offset ? 0 : header_offset;
[3641] Fix | Delete
$('#main-header').addClass('et_vertical_menu_set').css({
[3642] Fix | Delete
'left': '',
[3643] Fix | Delete
'right': header_offset
[3644] Fix | Delete
});
[3645] Fix | Delete
}
[3646] Fix | Delete
}
[3647] Fix | Delete
[3648] Fix | Delete
if ($et_header_style_split.length && !window.et_is_vertical_nav || is_customize_preview) {
[3649] Fix | Delete
et_header_menu_split();
[3650] Fix | Delete
$(window).resize(function () {
[3651] Fix | Delete
et_header_menu_split();
[3652] Fix | Delete
});
[3653] Fix | Delete
}
[3654] Fix | Delete
[3655] Fix | Delete
if (window.et_is_vertical_nav) {
[3656] Fix | Delete
if ($('#main-header').height() < $('#et-top-navigation').height()) {
[3657] Fix | Delete
$('#main-header').height($('#et-top-navigation').height() + $('#logo').height() + 100);
[3658] Fix | Delete
}
[3659] Fix | Delete
[3660] Fix | Delete
et_set_right_vertical_menu();
[3661] Fix | Delete
}
[3662] Fix | Delete
[3663] Fix | Delete
window.et_calculate_header_values = function () {
[3664] Fix | Delete
var $top_header = $('#top-header'),
[3665] Fix | Delete
secondary_nav_height = $top_header.length && $top_header.is(':visible') ? parseInt($top_header.innerHeight()) : 0,
[3666] Fix | Delete
admin_bar_height = $('#wpadminbar').length ? parseInt($('#wpadminbar').innerHeight()) : 0,
[3667] Fix | Delete
$slide_menu_container = $('.et_header_style_slide .et_slide_in_menu_container'),
[3668] Fix | Delete
is_rtl = $('body').hasClass('rtl');
[3669] Fix | Delete
et_header_height = parseInt($('#main-header').innerHeight()) + secondary_nav_height;
[3670] Fix | Delete
et_header_modifier = et_header_height <= 90 ? et_header_height - 29 : et_header_height - 56;
[3671] Fix | Delete
et_header_offset = et_header_modifier + admin_bar_height;
[3672] Fix | Delete
et_primary_header_top = secondary_nav_height + admin_bar_height;
[3673] Fix | Delete
[3674] Fix | Delete
if ($slide_menu_container.length && !$('body').hasClass('et_pb_slide_menu_active')) {
[3675] Fix | Delete
if (is_rtl) {
[3676] Fix | Delete
$slide_menu_container.css({
[3677] Fix | Delete
left: '-' + parseInt($slide_menu_container.innerWidth()) + 'px',
[3678] Fix | Delete
'display': 'none'
[3679] Fix | Delete
});
[3680] Fix | Delete
} else {
[3681] Fix | Delete
$slide_menu_container.css({
[3682] Fix | Delete
right: '-' + parseInt($slide_menu_container.innerWidth()) + 'px',
[3683] Fix | Delete
'display': 'none'
[3684] Fix | Delete
});
[3685] Fix | Delete
}
[3686] Fix | Delete
[3687] Fix | Delete
if ($('body').hasClass('et_boxed_layout')) {
[3688] Fix | Delete
if (is_rtl) {
[3689] Fix | Delete
var page_container_margin = $main_container_wrapper.css('margin-right');
[3690] Fix | Delete
$main_header.css({
[3691] Fix | Delete
right: page_container_margin
[3692] Fix | Delete
});
[3693] Fix | Delete
} else {
[3694] Fix | Delete
var page_container_margin = $main_container_wrapper.css('margin-left');
[3695] Fix | Delete
$main_header.css({
[3696] Fix | Delete
left: page_container_margin
[3697] Fix | Delete
});
[3698] Fix | Delete
}
[3699] Fix | Delete
}
[3700] Fix | Delete
}
[3701] Fix | Delete
};
[3702] Fix | Delete
[3703] Fix | Delete
var $comment_form = $('#commentform');
[3704] Fix | Delete
et_pb_form_placeholders_init($comment_form);
[3705] Fix | Delete
$comment_form.submit(function () {
[3706] Fix | Delete
et_pb_remove_placeholder_text($comment_form);
[3707] Fix | Delete
});
[3708] Fix | Delete
et_duplicate_menu($('#et-top-navigation ul.nav'), $('#et-top-navigation .mobile_nav'), 'mobile_menu', 'et_mobile_menu');
[3709] Fix | Delete
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.
[3710] Fix | Delete
[3711] Fix | Delete
if ($('ul.et_disable_top_tier').length) {
[3712] Fix | Delete
var $disbaled_top_tier_links = $("ul.et_disable_top_tier > li > ul").prev('a');
[3713] Fix | Delete
$disbaled_top_tier_links.attr('href', '#');
[3714] Fix | Delete
$disbaled_top_tier_links.on('click', function (e) {
[3715] Fix | Delete
e.preventDefault();
[3716] Fix | Delete
}); // Handle top tier links in cloned mobile menu
[3717] Fix | Delete
[3718] Fix | Delete
var $disbaled_top_tier_links_mobile = $("ul#mobile_menu > li > ul").prev('a');
[3719] Fix | Delete
$disbaled_top_tier_links_mobile.attr('href', '#');
[3720] Fix | Delete
$disbaled_top_tier_links_mobile.on('click', function (e) {
[3721] Fix | Delete
e.preventDefault();
[3722] Fix | Delete
});
[3723] Fix | Delete
}
[3724] Fix | Delete
[3725] Fix | Delete
if ($('#et-secondary-nav').length) {
[3726] Fix | Delete
$('#et-top-navigation #mobile_menu').append($('#et-secondary-nav').clone().html());
[3727] Fix | Delete
} // adding arrows for the slide/fullscreen menus
[3728] Fix | Delete
[3729] Fix | Delete
[3730] Fix | Delete
if ($('.et_slide_in_menu_container').length) {
[3731] Fix | Delete
var $item_with_sub = $('.et_slide_in_menu_container').find('.menu-item-has-children > a'); // add arrows for each menu item which has submenu
[3732] Fix | Delete
[3733] Fix | Delete
if ($item_with_sub.length) {
[3734] Fix | Delete
$item_with_sub.append('<span class="et_mobile_menu_arrow"></span>');
[3735] Fix | Delete
}
[3736] Fix | Delete
}
[3737] Fix | Delete
[3738] Fix | Delete
function et_change_primary_nav_position(delay) {
[3739] Fix | Delete
setTimeout(function () {
[3740] Fix | Delete
var etPrimaryHeaderTop = 0;
[3741] Fix | Delete
var $body = $('body');
[3742] Fix | Delete
var $wpadminbar = builder_scripts_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isBuilder"] ? top_window.jQuery('#wpadminbar') : $('#wpadminbar');
[3743] Fix | Delete
var $topHTML = top_window.jQuery('html');
[3744] Fix | Delete
var $topHeader = $('#top-header');
[3745] Fix | Delete
var isPreviewMode = $topHTML.is('.et-fb-preview--zoom:not(.et-fb-preview--desktop)');
[3746] Fix | Delete
isPreviewMode = isPreviewMode || $topHTML.is('.et-fb-preview--tablet');
[3747] Fix | Delete
isPreviewMode = isPreviewMode || $topHTML.is('.et-fb-preview--phone');
[3748] Fix | Delete
[3749] Fix | Delete
if ($wpadminbar.length && !Number.isNaN($wpadminbar.innerHeight())) {
[3750] Fix | Delete
var adminbarHeight = parseFloat($wpadminbar.innerHeight()); // Adjust admin bar height for builder's preview mode
[3751] Fix | Delete
// since admin bar is rendered on top window in these modes.
[3752] Fix | Delete
[3753] Fix | Delete
etPrimaryHeaderTop += builder_scripts_utils_utils__WEBPACK_IMPORTED_MODULE_0__["isBuilder"] && isPreviewMode ? 0 : adminbarHeight;
[3754] Fix | Delete
}
[3755] Fix | Delete
[3756] Fix | Delete
if ($topHeader.length && $topHeader.is(':visible')) {
[3757] Fix | Delete
etPrimaryHeaderTop += $topHeader.innerHeight();
[3758] Fix | Delete
}
[3759] Fix | Delete
[3760] Fix | Delete
var isFixedNav = $body.hasClass('et_fixed_nav');
[3761] Fix | Delete
var isAbsolutePrimaryNav = !isFixedNav && $body.hasClass('et_transparent_nav') && $body.hasClass('et_secondary_nav_enabled');
[3762] Fix | Delete
[3763] Fix | Delete
if (!window.et_is_vertical_nav && (isFixedNav || isAbsolutePrimaryNav)) {
[3764] Fix | Delete
$('#main-header').css('top', etPrimaryHeaderTop);
[3765] Fix | Delete
}
[3766] Fix | Delete
}, delay);
[3767] Fix | Delete
}
[3768] Fix | Delete
[3769] Fix | Delete
window.et_change_primary_nav_position = et_change_primary_nav_position;
[3770] Fix | Delete
[3771] Fix | Delete
function et_hide_nav_transform() {
[3772] Fix | Delete
var $body = $('body'),
[3773] Fix | Delete
$body_height = $(document).height(),
[3774] Fix | Delete
$viewport_height = $(window).height() + et_header_height + 200; // Do nothing when Vertical Navigation is Enabled
[3775] Fix | Delete
[3776] Fix | Delete
if ($body.hasClass('et_vertical_nav')) {
[3777] Fix | Delete
return;
[3778] Fix | Delete
}
[3779] Fix | Delete
[3780] Fix | Delete
if ($body.hasClass('et_hide_nav') || $body.hasClass('et_hide_nav_disabled') && $body.hasClass('et_fixed_nav')) {
[3781] Fix | Delete
if ($body_height > $viewport_height) {
[3782] Fix | Delete
if ($body.hasClass('et_hide_nav_disabled')) {
[3783] Fix | Delete
$body.addClass('et_hide_nav');
[3784] Fix | Delete
$body.removeClass('et_hide_nav_disabled');
[3785] Fix | Delete
}
[3786] Fix | Delete
[3787] Fix | Delete
$('#main-header').css('transform', 'translateY(-' + et_header_height + 'px)');
[3788] Fix | Delete
$('#top-header').css('transform', 'translateY(-' + et_header_height + 'px)');
[3789] Fix | Delete
} else {
[3790] Fix | Delete
$('#main-header').css({
[3791] Fix | Delete
'transform': 'translateY(0)',
[3792] Fix | Delete
'opacity': '1'
[3793] Fix | Delete
});
[3794] Fix | Delete
$('#top-header').css({
[3795] Fix | Delete
'transform': 'translateY(0)',
[3796] Fix | Delete
'opacity': '1'
[3797] Fix | Delete
});
[3798] Fix | Delete
$body.removeClass('et_hide_nav');
[3799] Fix | Delete
$body.addClass('et_hide_nav_disabled');
[3800] Fix | Delete
} // Run fix page container again, needed when body height is not tall enough and
[3801] Fix | Delete
// adjustment has been aded
[3802] Fix | Delete
[3803] Fix | Delete
[3804] Fix | Delete
et_fix_page_container_position();
[3805] Fix | Delete
}
[3806] Fix | Delete
} // Saving current styling for the next resize cycle
[3807] Fix | Delete
[3808] Fix | Delete
[3809] Fix | Delete
function et_save_initial_page_container_style($selector, property) {
[3810] Fix | Delete
var styling = {};
[3811] Fix | Delete
styling[property] = $selector.css(property);
[3812] Fix | Delete
$selector.attr({
[3813] Fix | Delete
'data-fix-page-container': 'on'
[3814] Fix | Delete
}).data({
[3815] Fix | Delete
'fix_page_container_style': styling
[3816] Fix | Delete
});
[3817] Fix | Delete
}
[3818] Fix | Delete
[3819] Fix | Delete
function et_page_load_scroll_to_anchor() {
[3820] Fix | Delete
var location_hash = window.et_location_hash.replace(/(\|)/g, "\\$1");
[3821] Fix | Delete
[3822] Fix | Delete
if ($(location_hash).length === 0) {
[3823] Fix | Delete
return;
[3824] Fix | Delete
}
[3825] Fix | Delete
[3826] Fix | Delete
var $map_container = $(location_hash + ' .et_pb_map_container');
[3827] Fix | Delete
var $map = $map_container.children('.et_pb_map');
[3828] Fix | Delete
var $target = $(location_hash); // Make the target element visible again
[3829] Fix | Delete
[3830] Fix | Delete
if ('undefined' !== typeof window.et_location_hash_style) {
[3831] Fix | Delete
$target.css('display', window.et_location_hash_style);
[3832] Fix | Delete
}
[3833] Fix | Delete
[3834] Fix | Delete
var distance = 'undefined' !== typeof $target.offset().top ? $target.offset().top : 0;
[3835] Fix | Delete
var speed = distance > 4000 ? 1600 : 800;
[3836] Fix | Delete
[3837] Fix | Delete
if ($map_container.length) {
[3838] Fix | Delete
google.maps.event.trigger($map[0], 'resize');
[3839] Fix | Delete
} // Workaround for reviews tab in woo tabs.
[3840] Fix | Delete
[3841] Fix | Delete
[3842] Fix | Delete
if ($target.parents().hasClass('commentlist')) {
[3843] Fix | Delete
$('.reviews_tab').click().animate({
[3844] Fix | Delete
scrollTop: $target.offset().top
[3845] Fix | Delete
}, 700);
[3846] Fix | Delete
} // Allow the header sizing functions enough time to finish before scrolling the page
[3847] Fix | Delete
[3848] Fix | Delete
[3849] Fix | Delete
setTimeout(function () {
[3850] Fix | Delete
et_pb_smooth_scroll($target, false, speed, 'swing'); // During the page scroll animation, the header's height might change.
[3851] Fix | Delete
// Do the scroll animation again to ensure its accuracy.
[3852] Fix | Delete
[3853] Fix | Delete
setTimeout(function () {
[3854] Fix | Delete
et_pb_smooth_scroll($target, false, 150, 'linear');
[3855] Fix | Delete
}, speed + 25);
[3856] Fix | Delete
}, 700);
[3857] Fix | Delete
} // Retrieving padding/margin value based on formatted saved padding/margin strings
[3858] Fix | Delete
[3859] Fix | Delete
[3860] Fix | Delete
function et_get_saved_padding_margin_value(saved_value, order) {
[3861] Fix | Delete
if (typeof saved_value === 'undefined') {
[3862] Fix | Delete
return false;
[3863] Fix | Delete
}
[3864] Fix | Delete
[3865] Fix | Delete
var values = saved_value.split('|');
[3866] Fix | Delete
return typeof values[order] !== 'undefined' ? values[order] : false;
[3867] Fix | Delete
}
[3868] Fix | Delete
[3869] Fix | Delete
function et_fix_page_container_position() {
[3870] Fix | Delete
var et_window_width = parseInt($et_window.width()),
[3871] Fix | Delete
$top_header = $('#top-header'),
[3872] Fix | Delete
$et_pb_first_row = et_get_first_section(),
[3873] Fix | Delete
secondary_nav_height = $top_header.length && $top_header.is(':visible') ? parseInt($top_header.innerHeight()) : 0,
[3874] Fix | Delete
main_header_fixed_height = 0,
[3875] Fix | Delete
header_height,
[3876] Fix | Delete
et_pb_first_row_padding_top;
[3877] Fix | Delete
var $mainHeaderClone = $main_header.clone().addClass('et-disabled-animations main-header-clone').css({
[3878] Fix | Delete
opacity: 0,
[3879] Fix | Delete
position: 'fixed',
[3880] Fix | Delete
top: 'auto',
[3881] Fix | Delete
right: 0,
[3882] Fix | Delete
bottom: 0,
[3883] Fix | Delete
left: 0
[3884] Fix | Delete
}).appendTo($('body')); // Replace previous resize cycle's adjustment
[3885] Fix | Delete
[3886] Fix | Delete
if (!$('body').hasClass('et-bfb')) {
[3887] Fix | Delete
$('*[data-fix-page-container="on"]').each(function () {
[3888] Fix | Delete
var $adjusted_element = $(this),
[3889] Fix | Delete
styling = $adjusted_element.data();
[3890] Fix | Delete
[3891] Fix | Delete
if (styling && styling.fix_page_container_style) {
[3892] Fix | Delete
// Reapply previous styling
[3893] Fix | Delete
$adjusted_element.css(styling.fix_page_container_style);
[3894] Fix | Delete
}
[3895] Fix | Delete
});
[3896] Fix | Delete
} // Set data-height-onload for header if the page is loaded on large screen
[3897] Fix | Delete
// If the page is loaded from small screen, rely on data-height-onload printed on the markup,
[3898] Fix | Delete
// prevent window resizing issue from small to large
[3899] Fix | Delete
// ignore data-height-loaded in VB to make sure it calculated correctly.
[3900] Fix | Delete
[3901] Fix | Delete
[3902] Fix | Delete
if (et_window_width > 980 && (!$main_header.attr('data-height-loaded') || $('body').is('.et-fb'))) {
[3903] Fix | Delete
var mainHeaderHeight = 0;
[3904] Fix | Delete
[3905] Fix | Delete
if ($main_header.hasClass('et-fixed-header')) {
[3906] Fix | Delete
$mainHeaderClone.removeClass('et-fixed-header');
[3907] Fix | Delete
mainHeaderHeight = $mainHeaderClone.height();
[3908] Fix | Delete
$mainHeaderClone.addClass('et-fixed-header');
[3909] Fix | Delete
} else {
[3910] Fix | Delete
mainHeaderHeight = $main_header.height();
[3911] Fix | Delete
}
[3912] Fix | Delete
[3913] Fix | Delete
$main_header.attr({
[3914] Fix | Delete
'data-height-onload': parseInt(mainHeaderHeight),
[3915] Fix | Delete
'data-height-loaded': true
[3916] Fix | Delete
});
[3917] Fix | Delete
} // Use on page load calculation for large screen. Use on the fly calculation for small screen (980px below)
[3918] Fix | Delete
[3919] Fix | Delete
[3920] Fix | Delete
if (et_window_width <= 980) {
[3921] Fix | Delete
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
[3922] Fix | Delete
// And NOT a pagebuilder page
[3923] Fix | Delete
[3924] Fix | Delete
if (window.et_is_transparent_nav && !$et_pb_first_row.length) {
[3925] Fix | Delete
header_height += 58;
[3926] Fix | Delete
}
[3927] Fix | Delete
} else {
[3928] Fix | Delete
// Get header height from header attribute
[3929] Fix | Delete
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
[3930] Fix | Delete
[3931] Fix | Delete
if (window.et_is_transparent_nav && !window.et_is_vertical_nav && $et_main_content_first_row.length) {
[3932] Fix | Delete
header_height += 58;
[3933] Fix | Delete
} // Calculate fixed header height by cloning, emulating, and calculating its height
[3934] Fix | Delete
[3935] Fix | Delete
[3936] Fix | Delete
main_header_fixed_height = $mainHeaderClone.height();
[3937] Fix | Delete
}
[3938] Fix | Delete
[3939] Fix | Delete
if (et_hide_nav) {
[3940] Fix | Delete
var topNavHeightDiff = parseInt($et_top_navigation.data('height')) - parseInt($et_top_navigation.data('fixed-height'));
[3941] Fix | Delete
main_header_fixed_height = parseInt($main_header.data('height-onload')) - topNavHeightDiff;
[3942] Fix | Delete
} // Saved fixed main header height calculation
[3943] Fix | Delete
[3944] Fix | Delete
[3945] Fix | Delete
$main_header.attr({
[3946] Fix | Delete
'data-fixed-height-onload': main_header_fixed_height
[3947] Fix | Delete
});
[3948] Fix | Delete
var $wooCommerceNotice = $('.et_fixed_nav.et_transparent_nav.et-db.et_full_width_page #left-area > .woocommerce-notices-wrapper');
[3949] Fix | Delete
[3950] Fix | Delete
if ($wooCommerceNotice.length > 0 && 'yes' !== $wooCommerceNotice.attr('data-position-set')) {
[3951] Fix | Delete
var wooNoticeMargin = main_header_fixed_height;
[3952] Fix | Delete
[3953] Fix | Delete
if (0 === wooNoticeMargin && $main_header.attr('data-height-onload')) {
[3954] Fix | Delete
wooNoticeMargin = $main_header.attr('data-height-onload');
[3955] Fix | Delete
}
[3956] Fix | Delete
[3957] Fix | Delete
$wooCommerceNotice.css('marginTop', parseFloat(wooNoticeMargin));
[3958] Fix | Delete
$wooCommerceNotice.animate({
[3959] Fix | Delete
'opacity': '1'
[3960] Fix | Delete
});
[3961] Fix | Delete
$wooCommerceNotice.attr('data-position-set', 'yes');
[3962] Fix | Delete
} // Specific adjustment required for transparent nav + not vertical nav + (not hidden nav
[3963] Fix | Delete
// OR hidden nav but document height is shorter than "viewport" height)
[3964] Fix | Delete
// NOTES:
[3965] Fix | Delete
// 1. hidden nav: nav is initially hidden then appears as the window is scrolled)
[3966] Fix | Delete
// 2. in hidden nav, nav is displayed as window is scrolled. If document height is
[3967] Fix | Delete
// shorter than viewport, vertical scroll doesn't exist and nav is directly rendered.
[3968] Fix | Delete
// Thus, transparent nav adjustment need to be applied if body is shorter than window
[3969] Fix | Delete
// 3. Hidden nav only works on desktop breakpoint. Nav is always displayed on tablet
[3970] Fix | Delete
// and smaller breakpoints
[3971] Fix | Delete
// 4. "viewport" height calculation needs to be identical with viewport calculation used
[3972] Fix | Delete
// at `et_hide_nav_transform()` to make sure that when nav is displayed due to short
[3973] Fix | Delete
// document height, the padding gets added
[3974] Fix | Delete
[3975] Fix | Delete
[3976] Fix | Delete
var bodyHeight = $(document).height();
[3977] Fix | Delete
var viewportHeight = $(window).height() + et_header_height + 200;
[3978] Fix | Delete
var isBodyShorterThanViewport = viewportHeight > bodyHeight;
[3979] Fix | Delete
var isDesktop = parseInt($(window).width()) > 980;
[3980] Fix | Delete
var isHideNavDesktop = isDesktop && et_hide_nav;
[3981] Fix | Delete
[3982] Fix | Delete
if (window.et_is_transparent_nav && !window.et_is_vertical_nav && (!isHideNavDesktop || isBodyShorterThanViewport)) {
[3983] Fix | Delete
if (!$('body').hasClass('et-bfb')) {
[3984] Fix | Delete
// Add class for first row for custom section padding purpose
[3985] Fix | Delete
$et_pb_first_row.addClass('et_pb_section_first');
[3986] Fix | Delete
} // List of conditionals
[3987] Fix | Delete
[3988] Fix | Delete
[3989] Fix | Delete
var is_pb = $et_pb_first_row.length,
[3990] Fix | Delete
is_post_pb = is_pb && $et_single_post.length,
[3991] Fix | Delete
is_post_pb_full_layout_has_title = $et_pb_post_fullwidth.length && $et_main_content_first_row_meta_wrapper_title.length,
[3992] Fix | Delete
is_post_pb_full_layout_no_title = $et_pb_post_fullwidth.length && 0 === $et_main_content_first_row_meta_wrapper_title.length,
[3993] Fix | Delete
is_post_with_tb_body = is_post_pb && $('.et-l--body').length,
[3994] Fix | Delete
is_pb_fullwidth_section_first = $et_pb_first_row.is('.et_pb_fullwidth_section'),
[3995] Fix | Delete
is_no_pb_mobile = et_window_width <= 980 && $et_main_content_first_row.length,
[3996] Fix | Delete
isProject = $('body').hasClass('single-project');
[3997] Fix | Delete
[3998] Fix | Delete
if (!is_post_with_tb_body && is_post_pb && !(is_post_pb_full_layout_no_title && is_pb_fullwidth_section_first) && !isProject) {
[3999] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function