307 lines
8.2 KiB
JavaScript
307 lines
8.2 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', '.control-label-nav', function () {
|
|
$('.control-label-nav').not(this).removeClass('active')
|
|
$('.control-label-nav').not(this).parent().parent().removeClass('active')
|
|
$('.control-label-nav')
|
|
.not(this)
|
|
.siblings('.form-control-select-custom')
|
|
.slideUp()
|
|
|
|
$(this).toggleClass('active')
|
|
$(this).parent().parent().toggleClass('active')
|
|
// $(this).siblings('.form-control-select-custom').slideToggle()
|
|
$(this)
|
|
.siblings('.form-control-select-custom')
|
|
.slideToggle(function () {
|
|
const $dropdown = $(this).find('.custom-dropdown')
|
|
const $items = $dropdown.find('li')
|
|
|
|
if ($items.length > 5) {
|
|
const itemHeight = $items.first().outerHeight(true)
|
|
const maxHeight = itemHeight * 5
|
|
const gap = 16
|
|
|
|
$dropdown.css({
|
|
'max-height': maxHeight + gap * 4 + 'px',
|
|
})
|
|
}
|
|
})
|
|
})
|
|
})
|
|
|
|
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 item0 = $('.blockreassurance_product .item-0')
|
|
|
|
if (item0.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)
|
|
})
|
|
|
|
item0.append(blockRaty)
|
|
}
|
|
}
|
|
}
|
|
|
|
$('.blockreassurance_product .item-0 .block-description').on(
|
|
'click',
|
|
function () {
|
|
const blockRaty = $('.blockreassurance_product .item-0 .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)
|
|
// }
|
|
// }
|
|
// })
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
function moveContent(retries = 20) {
|
|
// 20 * 500ms = 10s
|
|
var eratyElement = document.getElementById('eraty')
|
|
var wrapperElement = document.querySelector('.block-raty--wrapper')
|
|
|
|
if (eratyElement && wrapperElement) {
|
|
var eratyContent = eratyElement.innerHTML
|
|
eratyElement.innerHTML = ''
|
|
var newContent = document.createElement('div')
|
|
newContent.innerHTML = eratyContent
|
|
wrapperElement.appendChild(newContent)
|
|
} else if (retries > 0) {
|
|
setTimeout(() => moveContent(retries - 1), 500)
|
|
}
|
|
}
|
|
|
|
moveContent()
|
|
})
|
|
|
|
jQuery(document).ready(function ($) {
|
|
var windowHeight = $(window).height()
|
|
var dropdownMenuHeight = 0
|
|
|
|
function updateWindowHeight() {
|
|
windowHeight = $(window).height()
|
|
}
|
|
|
|
function checkOpenMenus() {
|
|
$('nav.leo-megamenu .leo-top-menu .navbar-nav li .dropdown-menu').each(
|
|
function () {
|
|
if ($(this).is(':visible')) {
|
|
var $menu = $(this)
|
|
dropdownMenuHeight = $menu.outerHeight()
|
|
|
|
// var offsetTop = $menu.offset().top
|
|
var offsetTop = $('header').height() - 20
|
|
// console.log('Offset top: ' + offsetTop + 'px',);
|
|
|
|
var maxHeight = windowHeight - offsetTop - 30
|
|
// console.log('Max height: ' + maxHeight + 'px',);
|
|
|
|
$menu.css('max-height', maxHeight + 'px')
|
|
}
|
|
}
|
|
)
|
|
}
|
|
|
|
function resetMaxHeights() {
|
|
$('nav.leo-megamenu .leo-top-menu .navbar-nav li .dropdown-menu').css(
|
|
'max-height',
|
|
''
|
|
)
|
|
}
|
|
|
|
updateWindowHeight()
|
|
|
|
$(window).resize(function () {
|
|
updateWindowHeight()
|
|
console.log('Window height: ' + windowHeight + 'px')
|
|
})
|
|
|
|
$('nav.leo-megamenu .leo-top-menu .navbar-nav > li').hover(
|
|
function () {
|
|
checkOpenMenus()
|
|
},
|
|
function () {
|
|
resetMaxHeights()
|
|
}
|
|
)
|
|
})
|
|
|
|
jQuery(document).ready(function ($) {
|
|
$('body').on('click', 'section.facet .show-more', function (e) {
|
|
e.preventDefault()
|
|
|
|
let $currentFacet = $(this).closest('section.facet')
|
|
|
|
$('section.facet')
|
|
.not($currentFacet)
|
|
.each(function () {
|
|
$(this).find('.toggle-facets .show-more-text').show()
|
|
$(this).find('.toggle-facets .show-less-text').hide()
|
|
$(this).find('.facet-items-hidden').slideUp()
|
|
})
|
|
|
|
$(this).find('.toggle-facets .show-more-text').toggle()
|
|
$(this).find('.toggle-facets .show-less-text').toggle()
|
|
$currentFacet.find('.facet-items-hidden').slideToggle()
|
|
})
|
|
})
|
|
|
|
// jQuery(document).ready(function ($) {
|
|
// var $btnBox = $('.scroll-brn-box')
|
|
|
|
// $(window).on('scroll', function () {
|
|
// if ($(this).scrollTop() > $(window).height() / 2) {
|
|
// $btnBox.addClass('active')
|
|
// } else {
|
|
// $btnBox.removeClass('active')
|
|
// }
|
|
// })
|
|
// })
|
|
|
|
jQuery(document).ready(function ($) {
|
|
$('body').append(`
|
|
<div class="scroll-brn-box">
|
|
<a href="#header" class="scroll-top-btn">
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="none">
|
|
<path d="M5 12L5 2" stroke="#fff"></path>
|
|
<path d="M1 5C2.33333 4.91228 5 3.78947 5 -3.56644e-07" stroke="#fff"></path>
|
|
<path d="M9 5C7.66667 4.91228 5 3.78947 5 2.05257e-08" stroke="#fff"></path>
|
|
</svg>
|
|
</a>
|
|
</div>
|
|
`)
|
|
|
|
var $btnBox = $('.scroll-brn-box')
|
|
|
|
$(window).on('scroll', function () {
|
|
if ($(this).scrollTop() > $(window).height() / 2) {
|
|
$btnBox.addClass('active')
|
|
} else {
|
|
$btnBox.removeClass('active')
|
|
}
|
|
})
|
|
})
|
|
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const buttons = document.querySelector('#category-description .custom-buttons');
|
|
const target = document.querySelector('.row.\\31 11');
|
|
if (buttons && target) {
|
|
target.parentNode.insertBefore(buttons, target);
|
|
}
|
|
});
|