/* CSS: */
.disable-scroll { overflow: hidden; }
*/ JS: */
// Select the node that will be observed for mutations
const targetNode = document.getElementsByClassName('elementor-menu-cart__container elementor-lightbox')[0];
const html = document.documentElement;
// Options for the observer (which mutations to observe)
const config = { attributes: true, childList: false, subtree: false };
// Callback function to execute when mutations are observed
const callback = function(mutationsList, observer) {
// Use traditional 'for loops' for IE 11
for(const mutation of mutationsList) {
if(mutation.attributeName == 'aria-hidden') {
if(mutation.target.ariaHidden === 'true') {
html.classList.remove('disable-scroll');
}
else {
html.classList.add('disable-scroll');
}
}
}
};
// Create an observer instance linked to the callback function
const observer = new MutationObserver(callback);
// Start observing the target node for configured mutations
observer.observe(targetNode, config);