jump immediately to Y-position without scroll animation
See original GitHub issueThanks Ash for this great piece of code,
The following is more a feature request than an “issue”
I´m experimenting a lot with this bundled with GSAP´s scrolltrigger. In my lastest application, it opens a fullscreen (scrollable) overlay. on close it should instantly jump to the last position (It remembers the offset value in a variable and apply it via "scrollTo(someoffset)"
). I´m wondering if it´s possible to jump immediately to a Y position without animating the scroll to there (example below). This could open up the possibilities for some nice transitions.
example of jumping content:
Looking forward to read from you 😃
Thanks and Greetings, Richard
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
how to scrollto without animation - javascript - Stack Overflow
This will jump directly to the position with no animations. var xPosition = 0; var yPosition = 1000; window.scrollTo(xPosition, yPosition);.
Read more >Save new Y position for subsequent animations - GSAP
If you want to start it immediately on scroll (and not jump) you could/should make the start dependent on the .offsetTop of your...
Read more >Smooth Scrolling | CSS-Tricks
Here's the code to perform a smooth page scroll to an anchor on the same page. It has some logic built in to...
Read more >Webflow - Reveal elements on scroll - YouTube
Reveal elements on scroll — Webflow interactions and animations ... In addition to configuring the trigger and animation, we'll also cover ...
Read more >Simple Background Scrolling Tutorial - YouTube
Do you want to know how to create scrolling backgrounds in 'your' Scratch projects? I'm Griffpatch, and I can't wait to share with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
absolutely awesome. works for me ❤️
(I´ll submit the finished site to your showcase later this year)
Hi @richard-unterberg , without seeing your full setup I think the best way to do what you’re asking is to explicitly set the target scroll position as well as the current smoothed scroll position like so:
y
would need to be the negative value of the position you want to scroll toI think I will add a method to do this without manually changing values in the future since I’ve needed to do this before as well.