Change filters, product lists, ...

This commit is contained in:
Roman Pyrih
2025-09-30 15:02:46 +02:00
parent 865d89efe1
commit c02b904f54
11 changed files with 365 additions and 199 deletions

View File

@@ -46,27 +46,32 @@ jQuery(document).ready(function ($) {
})
$(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();
$('.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');
$(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;
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'
});
}
});
$dropdown.css({
'max-height': maxHeight + gap * 4 + 'px',
})
}
})
})
})
@@ -138,31 +143,31 @@ jQuery(document).ready(function ($) {
}
})
document.addEventListener('click', (event) => {
const toggleButton = event.target.closest('.search-toggle')
// 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 (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'
// 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)'
}
// // 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)
}
}
})
// // Dodaj/usuń klasę active na kontenerze
// filtersContainer.classList.toggle('active', !isContentVisible)
// }
// }
// })
document.addEventListener('DOMContentLoaded', function () {
function moveContent(retries = 20) {
@@ -202,11 +207,9 @@ jQuery(document).ready(function ($) {
// 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')
}
@@ -237,3 +240,59 @@ jQuery(document).ready(function ($) {
}
)
})
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')
}
})
})