diff options
| author | Danilo M. <danix@danix.xyz> | 2026-04-21 15:11:11 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-04-21 15:11:11 +0200 |
| commit | 4e9a4a6483105d5eef1e3d769d6384c3af4ff4c9 (patch) | |
| tree | 0dde1821cc56f613574429019090a82215c33179 /themes/danix-xyz-hacker/assets/js | |
| parent | cca10206d39148b5b760a12f50213dcf7f322518 (diff) | |
| download | danixxyz-4e9a4a6483105d5eef1e3d769d6384c3af4ff4c9.tar.gz danixxyz-4e9a4a6483105d5eef1e3d769d6384c3af4ff4c9.zip | |
chore: adding files for agentic content writing
Diffstat (limited to 'themes/danix-xyz-hacker/assets/js')
| -rw-r--r-- | themes/danix-xyz-hacker/assets/js/article-lazy.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/assets/js/article-lazy.js b/themes/danix-xyz-hacker/assets/js/article-lazy.js new file mode 100644 index 0000000..64ca862 --- /dev/null +++ b/themes/danix-xyz-hacker/assets/js/article-lazy.js @@ -0,0 +1,34 @@ +document.addEventListener('DOMContentLoaded', function () { + var timeline = document.querySelector('ol.timeline'); + if (!timeline) return; + + // Progressive enhancement: activates CSS hidden state + timeline.classList.add('js-lazy-timeline'); + + var items = Array.prototype.slice.call( + timeline.querySelectorAll('.timeline-item') + ); + + function reveal(item) { + item.classList.add('is-visible'); + } + + var observer = new IntersectionObserver( + function (entries) { + entries.forEach(function (entry) { + if (entry.isIntersecting) { + reveal(entry.target); + observer.unobserve(entry.target); + } + }); + }, + { + rootMargin: '-80px 0px 0px 0px', + threshold: 0.12, + } + ); + + items.forEach(function (item) { + observer.observe(item); + }); +}); |
