shkola/wp-content/themes/dekart/assets/js/pksh-sticky-cta.js
2026-07-12 13:06:48 +00:00

22 lines
571 B
JavaScript

/**
* Sticky CTA — shows desktop bar when hero scrolls out of view
*
* IntersectionObserver on .ds-hero; toggles .visible on .sticky-cta-desktop.
*
* @package Dekart
*/
(function () {
var sticky = document.querySelector('.sticky-cta-desktop');
var hero = document.querySelector('.ds-hero');
if (!sticky || !hero) return;
var observer = new IntersectionObserver(function (entries) {
entries.forEach(function (entry) {
sticky.classList.toggle('visible', !entry.isIntersecting);
});
}, { threshold: 0 });
observer.observe(hero);
})();