This commit is contained in:
Roman Pyrih
2025-10-07 10:32:43 +02:00
parent a93c188165
commit d610aa8596
4 changed files with 190 additions and 20 deletions

View File

@@ -830,21 +830,19 @@ class Elementor_Places_Map extends \Elementor\Widget_Base
const bounds = new google.maps.LatLngBounds(); const bounds = new google.maps.LatLngBounds();
const markers = []; const markers = [];
let selectedLocation = null;
locations.forEach(loc => { locations.forEach(loc => {
if (loc.position && loc.position.lat && loc.position.lng) { if (loc.position && loc.position.lat && loc.position.lng) {
const marker = new google.maps.Marker({ const marker = new google.maps.Marker({
position: loc.position, position: loc.position,
map: map, map: map,
title: loc.name, title: loc.name,
icon: loc.icon || undefined icon: loc.icon || undefined
}); });
marker.addListener("click", () => { marker.addListener("click", () => {
const voivKey = Object.keys(voivodeships).find(k => voivodeships[k].id === loc.voivodeship.id); const voivKey = Object.keys(voivodeships).find(k => voivodeships[k].id === loc.voivodeship.id);
console.log(voivodeships);
console.log(voivodeships[voivKey].name);
if (voivKey) { if (voivKey) {
select.value = voivodeships[voivKey].name; select.value = voivodeships[voivKey].name;
renderList(voivodeships[voivKey].name); renderList(voivodeships[voivKey].name);
@@ -852,20 +850,23 @@ class Elementor_Places_Map extends \Elementor\Widget_Base
setTimeout(() => { setTimeout(() => {
const itemEl = listContainer.querySelector(`.location-item[data-id="${loc.id}"]`); const itemEl = listContainer.querySelector(`.location-item[data-id="${loc.id}"]`);
if (itemEl) { if (itemEl) {
const itemRect = itemEl.getBoundingClientRect(); const containerTop = listContainer.getBoundingClientRect().top;
const containerRect = listContainer.getBoundingClientRect(); const itemTop = itemEl.getBoundingClientRect().top;
const offsetTop = itemRect.top - containerRect.top; const scrollOffset = listContainer.scrollTop + (itemTop - containerTop);
console.log('itemRect.top: ', itemRect.top);
console.log('containerRect.top: ', containerRect.top);
console.log('offsetTop: ', offsetTop);
if (offsetTop != 0) { if(loc.id == selectedLocation) {
listContainer.scrollTo({ itemEl.classList.add('highlight');
top: offsetTop, setTimeout(() => itemEl.classList.remove('highlight'), 1000);
behavior: 'smooth' return;
}); } else {
selectedLocation = loc.id;
} }
listContainer.scrollTo({
top: scrollOffset,
behavior: 'smooth'
});
itemEl.classList.add('highlight'); itemEl.classList.add('highlight');
setTimeout(() => itemEl.classList.remove('highlight'), 1000); setTimeout(() => itemEl.classList.remove('highlight'), 1000);
} }

View File

@@ -975,4 +975,85 @@
#header-nav nav.elementor-nav-menu--main > ul.elementor-nav-menu .menu-item .sub-arrow { #header-nav nav.elementor-nav-menu--main > ul.elementor-nav-menu .menu-item .sub-arrow {
padding-left: 4px; padding-left: 4px;
} }
}
#contact-btn-absolute {
position: fixed;
bottom: 40px;
left: 40px;
z-index: 99999;
}
#contact-btn-absolute .elementor-button {
position: relative;
padding: 16px;
border-radius: 100%;
width: 56px;
height: 56px;
}
#contact-btn-absolute .elementor-button::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
border-radius: 100%;
background: #22a9e1;
animation: btn-pulse 2s infinite;
}
#contact-btn-absolute .elementor-button::after {
content: "";
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
border-radius: 100%;
background: #22a9e1;
animation: btn-pulse 2s infinite 0.5s;
}
#contact-btn-absolute .elementor-button .elementor-button-icon {
position: relative;
font-size: 24px;
animation: btn-pulse-icon 2s infinite;
z-index: 1;
}
@keyframes btn-pulse {
0% {
opacity: 1;
}
100% {
width: 100px;
height: 100px;
opacity: 0;
}
}
@keyframes btn-pulse-icon {
0% {
transform: rotate(0);
}
5% {
transform: rotate(5deg);
}
10% {
transform: rotate(-5deg);
}
15% {
transform: rotate(5deg);
}
20% {
transform: rotate(-5deg);
}
25% {
transform: rotate(5deg);
}
30% {
transform: rotate(-5deg);
}
35% {
transform: rotate(0);
}
}/*# sourceMappingURL=custom.css.map */ }/*# sourceMappingURL=custom.css.map */

File diff suppressed because one or more lines are too long

View File

@@ -1310,3 +1310,91 @@
} }
} }
} }
#contact-btn-absolute {
position: fixed;
bottom: 40px;
left: 40px;
z-index: 99999;
.elementor-button {
position: relative;
padding: 16px;
border-radius: 100%;
width: 56px;
height: 56px;
&::before {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
border-radius: 100%;
background: #22a9e1;
animation: btn-pulse 2s infinite;
}
&::after {
content: '';
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 50px;
height: 50px;
border-radius: 100%;
background: #22a9e1;
animation: btn-pulse 2s infinite 0.5s;
}
.elementor-button-icon {
position: relative;
font-size: 24px;
animation: btn-pulse-icon 2s infinite;
z-index: 1;
}
}
}
@keyframes btn-pulse {
0% {
opacity: 1;
}
100% {
width: 100px;
height: 100px;
opacity: 0;
}
}
@keyframes btn-pulse-icon {
0% {
transform: rotate(0);
}
5% {
transform: rotate(5deg);
}
10% {
transform: rotate(-5deg);
}
15% {
transform: rotate(5deg);
}
20% {
transform: rotate(-5deg);
}
25% {
transform: rotate(5deg);
}
30% {
transform: rotate(-5deg);
}
35% {
transform: rotate(0);
}
}