first commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import './stimulus_bootstrap.js';
|
||||
import './styles/app.css';
|
||||
|
||||
// Delikatne odsłanianie sekcji przy scrollu.
|
||||
const io = new IntersectionObserver((entries) => {
|
||||
for (const entry of entries) {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('is-visible');
|
||||
io.unobserve(entry.target);
|
||||
}
|
||||
}
|
||||
}, { threshold: 0.12 });
|
||||
|
||||
function initReveal() {
|
||||
document.querySelectorAll('.reveal:not(.is-visible)').forEach((el) => io.observe(el));
|
||||
}
|
||||
|
||||
// Ten plik ładuje się jako moduł (defer), więc DOM jest już sparsowany.
|
||||
// Startujemy od razu, a przy nawigacji Turbo ponawiamy obserwację.
|
||||
initReveal();
|
||||
document.addEventListener('turbo:load', initReveal);
|
||||
Reference in New Issue
Block a user