Save
This commit is contained in:
@@ -447,3 +447,50 @@ if (isEditing()) return;
|
||||
window.addEventListener('popstate', onNav);
|
||||
})();
|
||||
})();
|
||||
|
||||
$(document).ready(function () {
|
||||
|
||||
function toggleChatWidget(isOpen) {
|
||||
var $widget = $('div[data-testid="widgetButtonFrame"]');
|
||||
var $scrollBox = $('.scroll-brn-box')
|
||||
|
||||
if ($widget.length) {
|
||||
if (isOpen) {
|
||||
$widget.hide();
|
||||
$scrollBox.hide();
|
||||
} else {
|
||||
$widget.show();
|
||||
$scrollBox.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkCartState() {
|
||||
var $cart = $('.elementor-cart__container');
|
||||
var isOpen = $cart.hasClass('elementor-cart--shown');
|
||||
toggleChatWidget(isOpen);
|
||||
}
|
||||
|
||||
$('a[href*="koszyk"][class*="elementor-button"]').on('click', function () {
|
||||
setTimeout(checkCartState, 300);
|
||||
});
|
||||
|
||||
$(document).on('click', '.elementor-cart__close-button', function () {
|
||||
setTimeout(checkCartState, 300);
|
||||
});
|
||||
|
||||
$(document).on('click', '.elementor-cart__container.elementor-lightbox.elementor-cart--shown', function (e) {
|
||||
if (e.target === this) {
|
||||
setTimeout(checkCartState, 300);
|
||||
}
|
||||
});
|
||||
|
||||
const cartContainer = document.querySelector('.elementor-cart__container');
|
||||
if (cartContainer) {
|
||||
const observer = new MutationObserver(() => checkCartState());
|
||||
observer.observe(cartContainer, { attributes: true, attributeFilter: ['class'] });
|
||||
}
|
||||
|
||||
checkCartState();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user