Ever noticed how GitHub’s mobile app keeps the page repo details visible in a floating header as you scroll? It’s a slick UX touch that enhances navigation. In this post, I’ll show you how to achieve the same effect using Trig.js, the lightweight and ultra-fast scroll animation library.
Why Use Trig.js for Scroll Animations?
Most AOS (Animation on Scroll) libraries rely heavily on JavaScript for animations, which can impact performance. Trig.js is different—it’s CSS-based, meaning it leverages the browser’s GPU for smoother, more efficient animations.
✅ Why Trig.js?
⚡ Lightweight (~4KB) → No bloated dependencies
🎯 Optimized for scroll performance → No jank, no lag
🎨 Pure CSS scroll animations → Faster than JS-heavy alternatives
🏆 Best AOS alternative → Simple, powerful, and built for modern web apps
🛠️ Building the Floating Header Effect
🚀 Why Trig.js is the Best AOS Library for This?
Feature | Trig.js 🏆 | AOS.js | ScrollTrigger (GSAP) |
---|---|---|---|
Lightweight (~4KB) | ✅ | ❌ (~6KB) | ❌ (100KB+) |
CSS-based (Fastest) | ✅ | ❌ | ❌ (JS-heavy) |
Easy Setup | ✅ | ✅ | ❌ (Complex) |
Predefined Animations | ✅ | ✅ | ✅ |
🏁 Final Thoughts
Trig.js makes it ridiculously easy to create scroll-based animations with zero JavaScript complexity. Whether you’re building sticky headers, fade-ins, or full-page animations, it’s the best AOS alternative in 2025.
Why not have a look at our Trig.js AOS tutorial and give it ago for yourself.
💬 What do you think? Would you use this in your project? Let me know in the comments! 👇
🔗 Try Trig.js Today | Docs | GitHub Repo