Skip to content

Instantly share code, notes, and snippets.

@baslie
Created July 2, 2024 09:11
Show Gist options
  • Save baslie/acd1f0a1cdb6c49ce65eca347ecca0fe to your computer and use it in GitHub Desktop.
Save baslie/acd1f0a1cdb6c49ce65eca347ecca0fe to your computer and use it in GitHub Desktop.
Плавный скролл по странице
<!-- Плавный скролл по странице -->
<script src="https://unpkg.com/@studio-freight/lenis@1.0.42/dist/lenis.min.js"></script>
<script>
const lenis = new Lenis({
lerp: 0.1,
easing: (t) => Math.min(1, 1.001 - Math.pow(2, -10 * t)),
orientation: 'vertical',
gestureOrientation: 'vertical',
smoothWheel: true,
wheelMultiplier: 0.95,
syncTouch: false,
touchMultiplier: 1.1,
infinite: false,
})
function raf(time) {
lenis.raf(time)
requestAnimationFrame(raf)
}
requestAnimationFrame(raf)
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment