rebase from live enviornment

This commit is contained in:
Rachit Bhargava
2024-01-09 22:14:20 -05:00
parent ff0b49a046
commit 3a22fcaa4a
15968 changed files with 2344674 additions and 45234 deletions

View File

@@ -0,0 +1,48 @@
// External dependencies
import $ from 'jquery';
/**
* Toggle background-layout classname of current module and/or its child modules.
*
* @since 4.6.0
*
* @param {object} $module
* @param {bool} status
*/
export const toggleAllBackgroundLayoutClassnameOnSticky = ($module, status) => {
// Toggle background-layout classname if it is on current $module
if ($module.is($('[data-background-layout-sticky]'))) {
toggleBackgroundLayoutClassnameOnSticky($module, status);
}
// Toggle background-layout classname if it is child module of current module
if ($module.find('[data-background-layout-sticky]').length > 0) {
$module.find('[data-background-layout-sticky]').each(function() {
toggleBackgroundLayoutClassnameOnSticky($(this), status);
});
}
};
/**
* Toggle background-layout classname of current module.
*
* @since 4.6.0
*
* @param {object} $module
* @param {bool} status
*/
export const toggleBackgroundLayoutClassnameOnSticky = ($module, status) => {
const attrPrefix = status ? '-sticky' : '';
const allClassnames = 'et_pb_bg_layout_dark et_pb_bg_layout_light';
const layoutColor = $module.attr(`data-background-layout${attrPrefix}`);
const layoutClassname = `et_pb_bg_layout_${layoutColor}`;
let $target = $module;
// Switch the target element for some modules.
if ($module.hasClass('et_pb_slide')) {
$target = $module.closest('.et_pb_slider');
}
$target.removeClass(allClassnames).addClass(layoutClassname);
};