Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
proweb1991

smooth scroll

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

hi ...

i want create a smooth scroll effect , i have 5 section , and want create smooth scroll effect between sections on page scroll like http://www.combidome.com/#/start  with ScrollToPlugin , 

in ScrollToPlugin docs , i don't find any solution for on scroll event , all example show  click event for run scrolltoplugin !!

 

can any1 help me??

See the Pen XzPMXd by anon (@anon) on CodePen

Link to comment
Share on other sites

that type of scroll hijacking can be kind of disorienting. I don't really do much stuff like that.

However, once you detect which direction and how much the user has scrolled you can generate the appropriate scrollTo tween.

 

I've seen Hamster mentioned a few times for tapping into the mousewheel: http://monospaced.github.io/hamster.js/

 

In the demo below, just scroll down very slowly. you will see how it triggers a scrollTo tween.

 

You would still need to add quite  bit of logic. The mousewheel events fire very often so you my want make sure you aren't creating new tweens all the time or scroll 30 sections in the course of 3 seconds. You would also need to make sure you can scroll the other way too.

 

I used the count variable just as a quick and dirty way to increment how far to scroll. I think you would have to put a bit more thought into this.

We have to keep our support focused on the GSAP API, but maybe the demo below helps a little. Its just a very rough proof concept.

 

See the Pen EbeLgg by hansel234 (@hansel234) on CodePen

 

  • Like 1
Link to comment
Share on other sites

thank  carl

on window scroll , if can get current section , and find next or prev section ( Detected according to direction ) and run scrollTo with defined id ,  maybe work ...

but how?

i can not detect and run plugin :( 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×