| 1 |
(function () { |
| 2 |
'use strict'; |
| 3 |
|
| 4 |
document.querySelectorAll('.bkbg-lc-wrapper').forEach(function (wrapper) { |
| 5 |
/* ── Staggered card entrance animation ───────────────────── */ |
| 6 |
if (!('IntersectionObserver' in window)) return; |
| 7 |
|
| 8 |
var cards = wrapper.querySelectorAll('.bkbg-lc-card'); |
| 9 |
cards.forEach(function (card, i) { |
| 10 |
card.style.opacity = '0'; |
| 11 |
card.style.transform = 'translateY(24px)'; |
| 12 |
card.style.transition = 'opacity 0.45s ease ' + (i * 0.08) + 's, transform 0.45s ease ' + (i * 0.08) + 's'; |
| 13 |
}); |
| 14 |
|
| 15 |
var io = new IntersectionObserver(function (entries) { |
| 16 |
entries.forEach(function (entry) { |
| 17 |
if (!entry.isIntersecting) return; |
| 18 |
entry.target.style.opacity = '1'; |
| 19 |
entry.target.style.transform = 'translateY(0)'; |
| 20 |
io.unobserve(entry.target); |
| 21 |
}); |
| 22 |
}, { threshold: 0.08 }); |
| 23 |
|
| 24 |
cards.forEach(function (card) { io.observe(card); }); |
| 25 |
|
| 26 |
/* ── Directions button → open Google Maps ────────────────── */ |
| 27 |
wrapper.querySelectorAll('.bkbg-lc-btn-directions[data-address]').forEach(function (btn) { |
| 28 |
btn.addEventListener('click', function () { |
| 29 |
var addr = btn.getAttribute('data-address'); |
| 30 |
if (!addr) return; |
| 31 |
window.open('https://www.google.com/maps/search/' + encodeURIComponent(addr), '_blank', 'noopener'); |
| 32 |
}); |
| 33 |
}); |
| 34 |
}); |
| 35 |
})(); |
| 36 |
|