Files
vinoteca/local/templates/jinove_wine/assets/js/vino-reveal.js
T

29 lines
1.4 KiB
JavaScript

(function (run) {
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run);
else run();
})(function () {
(function () {
var root = document.documentElement;
if (!root.classList.contains('vino-reveal')) return;
var els = document.querySelectorAll('.vino-section, .vino-story, .vino-sales, .vino-footer, .vino-pdp, .vino-reviews, .vino-pdp-related, .vino-auth:not(.vino-auth--embed), .vino-cab, .vino-cart, .vino-order, .vino-done, .vino-about__panel, .vino-brand-detail, .vino-article, .vino-news-feed, .vino-offers, .vino-offer, .vino-offers-wines, .vino-showcase, .vino-showcase-shots');
els.forEach(function (el) {
el.classList.add('vino-reveal__item');
if (el.classList.contains('vino-section') || el.classList.contains('vino-news-feed') || el.classList.contains('vino-offers-wines')) el.classList.add('vino-reveal__item--deep');
});
var seen = false;
var io = new IntersectionObserver(function (list) {
seen = true;
list.forEach(function (e) {
if (e.isIntersecting) {
e.target.classList.add('vino-reveal__item--visible');
io.unobserve(e.target);
}
});
}, { rootMargin: '0px 0px -12% 0px' });
els.forEach(function (el) { io.observe(el); });
setTimeout(function () {
if (!seen) els.forEach(function (el) { el.classList.add('vino-reveal__item--visible'); });
}, 3000);
})();
});