Adaptive header menu scroll
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -3430,6 +3430,7 @@ body#authentication {
|
||||
.dropdown-menu {
|
||||
background: #f9f7f2;
|
||||
border: 1px solid #110e0c1a;
|
||||
overflow: auto;
|
||||
|
||||
a {
|
||||
&:hover {
|
||||
|
||||
@@ -1,159 +1,216 @@
|
||||
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(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}`);
|
||||
$(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');
|
||||
$customWrapper.find('.custom-dropdown li').removeClass('active')
|
||||
$selectedOption.addClass('active')
|
||||
|
||||
$originalSelect.val($selectedOption.data('value')).change();
|
||||
});
|
||||
$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();
|
||||
$(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');
|
||||
});
|
||||
$customWrapper.find('.custom-dropdown li').removeClass('active')
|
||||
$customWrapper
|
||||
.find(`.custom-dropdown li[data-value="${value}"]`)
|
||||
.addClass('active')
|
||||
})
|
||||
|
||||
|
||||
$(document).on('click', '.control-label-nav', function () {
|
||||
$(this).toggleClass('active');
|
||||
$(this).parent().parent().toggleClass('active');
|
||||
$(this).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).on('click', '.control-label-nav', function () {
|
||||
$(this).toggleClass('active')
|
||||
$(this).parent().parent().toggleClass('active')
|
||||
$(this).siblings('.form-control-select-custom').slideToggle()
|
||||
})
|
||||
})
|
||||
|
||||
document.addEventListener("click", (event) => {
|
||||
const toggleButton = event.target.closest(".search-toggle");
|
||||
jQuery(document).ready(function ($) {
|
||||
if ($('#product').length) {
|
||||
const additionalInfo = $('.product-additional-info')
|
||||
|
||||
if (toggleButton) {
|
||||
const filtersContainer = document.querySelector("#search_filters");
|
||||
const filtersContent = filtersContainer?.querySelector(".content");
|
||||
if (additionalInfo.length) {
|
||||
const elementsToCopy = []
|
||||
|
||||
if (filtersContainer && filtersContent) {
|
||||
// Pokaż/ukryj zawartość
|
||||
const isContentVisible = filtersContent.style.display === "grid";
|
||||
filtersContent.style.display = isContentVisible ? "none" : "grid";
|
||||
const selectors = ['.single_raty', '#oblicz-rate', '#caraty']
|
||||
|
||||
// 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)";
|
||||
}
|
||||
selectors.forEach((selector) => {
|
||||
const element = additionalInfo.find(selector)
|
||||
if (element.length) {
|
||||
elementsToCopy.push(element.clone())
|
||||
}
|
||||
})
|
||||
|
||||
// Dodaj/usuń klasę active na kontenerze
|
||||
filtersContainer.classList.toggle("active", !isContentVisible);
|
||||
}
|
||||
}
|
||||
});
|
||||
if (elementsToCopy.length) {
|
||||
const item1 = $('.blockreassurance_product .item-1')
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
function moveContent(retries = 20) { // 20 * 500ms = 10s
|
||||
var eratyElement = document.getElementById("eraty");
|
||||
var wrapperElement = document.querySelector(".block-raty--wrapper");
|
||||
if (item1.length) {
|
||||
const blockRaty = $(
|
||||
'<div class="block-raty"><div class="block-raty--wrapper"></div></div>'
|
||||
)
|
||||
const wrapper = blockRaty.find('.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);
|
||||
}
|
||||
}
|
||||
elementsToCopy.forEach((element) => {
|
||||
wrapper.append(element)
|
||||
})
|
||||
|
||||
moveContent();
|
||||
});
|
||||
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)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
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 maxHeight = windowHeight - offsetTop - 30
|
||||
|
||||
$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()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user