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 = $( '
' ) 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() } ) })