2026-07-27 17:00:30 +00:00

26 lines
622 B
JavaScript

/**
* Sticky CTA — shared IntersectionObserver
*
* Shows desktop sticky bar when hero/sections scroll out of view.
* Mobile sticky is CSS-only (always visible).
*
* @package Dekart
*/
(function () {
'use strict';
var desktop = document.querySelector('.sticky-cta-desktop');
var hero = document.querySelector('.ds-hero, .hero-front');
if (!desktop || !hero) return;
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
desktop.classList.toggle('visible', !entry.isIntersecting);
});
}, { threshold: 0 });
observer.observe(hero);
})();