question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

jump immediately to Y-position without scroll animation

See original GitHub issue

Thanks 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: example

Looking forward to read from you 😃

Thanks and Greetings, Richard

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
richard-unterbergcommented, Oct 27, 2020

absolutely awesome. works for me ❤️

(I´ll submit the finished site to your showcase later this year)

1reaction
ashthorntoncommented, Oct 27, 2020

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:

ASScroll.Scroll.scrollPos = y
ASScroll.Scroll.smoothScrollPos = y

y would need to be the negative value of the position you want to scroll to

I 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found