update
This commit is contained in:
@@ -1403,3 +1403,164 @@ button.carei-reservation-trigger:hover {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Carei Map Widget
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
.carei-map {
|
||||
position: relative;
|
||||
max-width: 520px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.carei-map__svg {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.carei-map__pin {
|
||||
cursor: pointer;
|
||||
transition: r 0.2s ease, fill 0.2s ease;
|
||||
}
|
||||
|
||||
.carei-map__pin:hover,
|
||||
.carei-map__pin--active {
|
||||
r: 8;
|
||||
}
|
||||
|
||||
.carei-map__tooltip {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
z-index: 10;
|
||||
transform: translate(-50%, -100%);
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
|
||||
.carei-map__tooltip-content {
|
||||
background: var(--carei-blue);
|
||||
color: var(--carei-white);
|
||||
font-family: var(--carei-font);
|
||||
font-size: 13px;
|
||||
line-height: 1.4;
|
||||
padding: 10px 14px;
|
||||
border-radius: var(--carei-radius);
|
||||
white-space: pre-line;
|
||||
min-width: 160px;
|
||||
max-width: 260px;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
|
||||
}
|
||||
|
||||
.carei-map__tooltip-content::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
bottom: 4px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
border: 6px solid transparent;
|
||||
border-top-color: var(--carei-blue);
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Carei Cities Widget
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
.carei-cities {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
align-items: center;
|
||||
gap: 6px 0;
|
||||
font-family: var(--carei-font);
|
||||
font-size: 15px;
|
||||
font-weight: 500;
|
||||
color: var(--carei-blue);
|
||||
line-height: 2;
|
||||
}
|
||||
|
||||
.carei-cities__item {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.carei-cities__item::after {
|
||||
content: '|';
|
||||
padding: 0 14px;
|
||||
opacity: 0.35;
|
||||
font-weight: 300;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.carei-cities__item:last-child::after {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.carei-cities {
|
||||
font-size: 13px;
|
||||
gap: 4px 0;
|
||||
}
|
||||
.carei-cities__item::after {
|
||||
padding: 0 8px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Carei Branches Widget
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
.carei-branches {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(5, 1fr);
|
||||
font-family: var(--carei-font);
|
||||
color: var(--carei-white);
|
||||
}
|
||||
|
||||
.carei-branches__item {
|
||||
padding: 24px 16px;
|
||||
text-align: center;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
|
||||
.carei-branches__name {
|
||||
font-size: 16px;
|
||||
font-weight: 700;
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
|
||||
.carei-branches__street,
|
||||
.carei-branches__zip-city {
|
||||
font-size: 14px;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
opacity: 0.85;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
.carei-branches {
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 767px) {
|
||||
.carei-branches {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
.carei-branches__item {
|
||||
padding: 18px 12px;
|
||||
}
|
||||
.carei-branches__name {
|
||||
font-size: 14px;
|
||||
}
|
||||
.carei-branches__street,
|
||||
.carei-branches__zip-city {
|
||||
font-size: 13px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 480px) {
|
||||
.carei-branches {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1265,6 +1265,110 @@
|
||||
initClearErrors();
|
||||
initAbroad();
|
||||
initSubmit();
|
||||
initMap();
|
||||
}
|
||||
|
||||
/* ═══════════════════════════════════════════
|
||||
Carei Map — dynamic pins & tooltips
|
||||
═══════════════════════════════════════════ */
|
||||
|
||||
function initMap() {
|
||||
var mapEl = document.querySelector('.carei-map');
|
||||
if (!mapEl) return;
|
||||
|
||||
var pins;
|
||||
try {
|
||||
pins = JSON.parse(mapEl.getAttribute('data-pins') || '[]');
|
||||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
if (!pins.length) return;
|
||||
|
||||
var svg = mapEl.querySelector('.carei-map__svg');
|
||||
var pinsGroup = svg.querySelector('.carei-map__pins');
|
||||
var tooltip = mapEl.querySelector('.carei-map__tooltip');
|
||||
var tooltipContent = mapEl.querySelector('.carei-map__tooltip-content');
|
||||
if (!svg || !pinsGroup || !tooltip || !tooltipContent) return;
|
||||
|
||||
var activePin = null;
|
||||
var SVG_NS = 'http://www.w3.org/2000/svg';
|
||||
|
||||
pins.forEach(function (pin) {
|
||||
var circle = document.createElementNS(SVG_NS, 'circle');
|
||||
circle.setAttribute('cx', pin.x);
|
||||
circle.setAttribute('cy', pin.y);
|
||||
circle.setAttribute('r', '6');
|
||||
circle.setAttribute('fill', '#FF0000');
|
||||
circle.setAttribute('class', 'carei-map__pin');
|
||||
circle.setAttribute('data-city', pin.city);
|
||||
circle.setAttribute('data-address', pin.address || '');
|
||||
|
||||
circle.addEventListener('mouseenter', function () {
|
||||
showTooltip(pin, circle);
|
||||
});
|
||||
circle.addEventListener('mouseleave', function () {
|
||||
if (activePin !== circle) {
|
||||
hideTooltip();
|
||||
}
|
||||
});
|
||||
circle.addEventListener('click', function (e) {
|
||||
e.stopPropagation();
|
||||
if (activePin === circle) {
|
||||
activePin = null;
|
||||
circle.classList.remove('carei-map__pin--active');
|
||||
hideTooltip();
|
||||
} else {
|
||||
if (activePin) activePin.classList.remove('carei-map__pin--active');
|
||||
activePin = circle;
|
||||
circle.classList.add('carei-map__pin--active');
|
||||
showTooltip(pin, circle);
|
||||
}
|
||||
});
|
||||
|
||||
pinsGroup.appendChild(circle);
|
||||
});
|
||||
|
||||
// Click outside closes tooltip
|
||||
document.addEventListener('click', function () {
|
||||
if (activePin) {
|
||||
activePin.classList.remove('carei-map__pin--active');
|
||||
activePin = null;
|
||||
hideTooltip();
|
||||
}
|
||||
});
|
||||
|
||||
function showTooltip(pin, circle) {
|
||||
// Build tooltip text: address lines + bold city
|
||||
var addr = pin.address || '';
|
||||
var lines = addr ? addr.replace(/\\n/g, '\n') : pin.city;
|
||||
tooltipContent.textContent = '';
|
||||
|
||||
// If address has postal code, format nicely
|
||||
if (addr) {
|
||||
tooltipContent.innerHTML = addr.replace(/\n/g, '<br>');
|
||||
} else {
|
||||
tooltipContent.textContent = pin.city;
|
||||
}
|
||||
|
||||
// Position tooltip relative to map container
|
||||
var svgRect = svg.getBoundingClientRect();
|
||||
var mapRect = mapEl.getBoundingClientRect();
|
||||
var svgWidth = svg.viewBox.baseVal.width || 600;
|
||||
var svgHeight = svg.viewBox.baseVal.height || 570;
|
||||
var scaleX = svgRect.width / svgWidth;
|
||||
var scaleY = svgRect.height / svgHeight;
|
||||
|
||||
var left = (svgRect.left - mapRect.left) + pin.x * scaleX;
|
||||
var top = (svgRect.top - mapRect.top) + pin.y * scaleY;
|
||||
|
||||
tooltip.style.display = 'block';
|
||||
tooltip.style.left = left + 'px';
|
||||
tooltip.style.top = top + 'px';
|
||||
}
|
||||
|
||||
function hideTooltip() {
|
||||
tooltip.style.display = 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
|
||||
Reference in New Issue
Block a user