141 lines
4.8 KiB
JavaScript
141 lines
4.8 KiB
JavaScript
jQuery(function($) {
|
|
if($("#simple-blog-box").length) {
|
|
var swiper = new Swiper('#simple-blog-box', {
|
|
slidesPerView: 3,
|
|
spaceBetween: 30,
|
|
navigation: {
|
|
nextEl: '.elementor-swiper-button-next',
|
|
prevEl: '.elementor-swiper-button-prev',
|
|
},
|
|
loop: true,
|
|
});
|
|
}
|
|
})
|
|
|
|
jQuery(document).ready(function ($) {
|
|
$(document).on('click', '.form-control-select-custom .custom-dropdown li', function () {
|
|
const $selectedOption = $(this);
|
|
const $customWrapper = $selectedOption.closest('.form-control-select-custom');
|
|
const originalSelectId = $customWrapper.data('product-attribute');
|
|
const $originalSelect = $(`#group_${originalSelectId}`);
|
|
|
|
$customWrapper.find('.custom-dropdown li').removeClass('active');
|
|
$selectedOption.addClass('active');
|
|
|
|
$originalSelect.val($selectedOption.data('value')).change();
|
|
});
|
|
|
|
$(document).on('change', '.form-control-select-standard', function () {
|
|
const $originalSelect = $(this);
|
|
const originalSelectId = $originalSelect.attr('id').replace('group_', '');
|
|
const $customWrapper = $(`.form-control-select-custom[data-product-attribute="${originalSelectId}"]`);
|
|
const value = $originalSelect.val();
|
|
|
|
$customWrapper.find('.custom-dropdown li').removeClass('active');
|
|
$customWrapper
|
|
.find(`.custom-dropdown li[data-value="${value}"]`)
|
|
.addClass('active');
|
|
});
|
|
|
|
|
|
$(document).on('click', '.form-control-select-standard-handler', function () {
|
|
$(this).parent().toggleClass('active');
|
|
$(this).parent().parent().parent().toggleClass('active');
|
|
$(this).parent().siblings('.form-control-select-custom').slideToggle();
|
|
});
|
|
});
|
|
|
|
|
|
jQuery(document).ready(function ($) {
|
|
if ($("#product").length) {
|
|
const additionalInfo = $(".product-additional-info");
|
|
|
|
if (additionalInfo.length) {
|
|
const elementsToCopy = [];
|
|
|
|
const selectors = [
|
|
".single_raty",
|
|
"#oblicz-rate",
|
|
"#caraty"
|
|
];
|
|
|
|
selectors.forEach(selector => {
|
|
const element = additionalInfo.find(selector);
|
|
if (element.length) {
|
|
elementsToCopy.push(element.clone());
|
|
}
|
|
});
|
|
|
|
if (elementsToCopy.length) {
|
|
const item1 = $(".blockreassurance_product .item-1");
|
|
|
|
if (item1.length) {
|
|
const blockRaty = $('<div class="block-raty"><div class="block-raty--wrapper"></div></div>');
|
|
const wrapper = blockRaty.find('.block-raty--wrapper');
|
|
|
|
elementsToCopy.forEach(element => {
|
|
wrapper.append(element);
|
|
});
|
|
|
|
item1.append(blockRaty);
|
|
}
|
|
}
|
|
}
|
|
|
|
$(".blockreassurance_product .item-1 .block-description").on("click", function () {
|
|
const blockRaty = $(".blockreassurance_product .item-1 .block-raty");
|
|
if (blockRaty.length) {
|
|
blockRaty.slideToggle();
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
jQuery(document).ready(function ($) {
|
|
if ($("#product").length) {
|
|
$(".accordion-item").addClass("active");
|
|
$(".accordion-item-body").show();
|
|
|
|
$(".accordion-item-header").click(function(){
|
|
$(".accordion-item-body").slideUp();
|
|
$(".accordion-item").removeClass("active");
|
|
|
|
if ($(this).next(".accordion-item-body").is(":hidden")) {
|
|
$(this).next(".accordion-item-body").slideDown();
|
|
$(this).parent().addClass("active");
|
|
}
|
|
});
|
|
|
|
|
|
$(".product-description-box .product-description-box-img").css(
|
|
"top",
|
|
$("#header-panel-box").height() + 64
|
|
)
|
|
|
|
}
|
|
})
|
|
|
|
document.addEventListener("click", (event) => {
|
|
const toggleButton = event.target.closest(".search-toggle");
|
|
|
|
if (toggleButton) {
|
|
const filtersContainer = document.querySelector("#search_filters");
|
|
const filtersContent = filtersContainer?.querySelector(".content");
|
|
|
|
if (filtersContainer && filtersContent) {
|
|
// Pokaż/ukryj zawartość
|
|
const isContentVisible = filtersContent.style.display === "grid";
|
|
filtersContent.style.display = isContentVisible ? "none" : "grid";
|
|
|
|
// Obróć obrazek w przycisku
|
|
const img = toggleButton.querySelector("img");
|
|
if (img && img.src.includes("chevron-up.svg")) {
|
|
img.style.transform = isContentVisible ? "rotate(0deg)" : "rotate(180deg)";
|
|
}
|
|
|
|
// Dodaj/usuń klasę active na kontenerze
|
|
filtersContainer.classList.toggle("active", !isContentVisible);
|
|
}
|
|
}
|
|
});
|