Jump to content
GreenSock

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

Looping a mousescroll initiated timeline

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 have a pageless site that I'm working on, that has a slightly unusual navigation/ flow. I've got it working almost as it's supposed to. 

 

There's two main ways for a visitor to navigate the site. Note: the pages/sections are not presented in a linear fashion.

 

1. By scrolling they will move on to the next "page" or section. 

2. Through the navigation menu they will go directly to the section

 

The issue I am having is can't quite figure out how to make the whole thing loop continuously. When they get to page 9 and they continue to mouse, I'm trying to get it so they just go straight back to page 1, and if they mouse up from page 1 it will take them to slide 9

 

Any guidance is much appreciated!

 

 

 

 

See the Pen grzamO by ald603 (@ald603) on CodePen

Link to comment
Share on other sites

I don't have time to work up a codepen but essentially you could check if the next label is available (like you currently are) and if it's not, simply tween to the label you want.

 

If you scroll down on slide9, check if a next label is available. If not, tween to label 'slide1'.

And the same for going from slide1 to 9.

 

The code for tweening to a label is:

myTimeline.tweenTo("myLabel")
  • Like 2
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.
×