Jump to content
Search Community

Fullscreen slides with TweenLite, CSSPlugin and ScrollToPlugin

Yngwie test
Moderator Tag

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!

This is excellent starter for playing with fullscreen sections transitions. But I have one question...

For example, if we have 6 sections and 2 of them require more height than the screen size is (because of the content).How

to achieve effect of scrolling to the end of that section first and then start transition to next section?

Basically what I meaned, is it possible to have sections with different heights based on the content and then, when

we scroll to the end of that content, start transition to next section in the way which is presented in this demo? 

 

Thanx!

See the Pen kDvmC by bassta (@bassta) on CodePen

Link to comment
Share on other sites

I assume you're talking about the wheel event, right?

 

Yes, you could do that. You'd have to add some logic to check the height of the current active section and only fire the scrollTo the next section if the bottom of the active section is above or equal to the bottom of the window.

 

Hopefully that makes sense. Happy tweening.

  • Like 4
Link to comment
Share on other sites

If you don't need the slidecontainer wrapper you can get rid of it and scroll the window instead.

Then you could use jquery to get the offset position of the slides and scroll the window to that. 

 

 

 

See the Pen PLpoBp by Visual-Q (@Visual-Q) on CodePen

 

 

UPDATE: DOH I see I didn't read the original question entirely this only gets you part way solving for scrolling different sized sections, to scroll normally to the bottom of an oversized item you would also have to do as Craig said and test the position of the current slide against the window:

 

This might help:

https://stackoverflow.com/questions/4653911/jquery-detecting-if-the-bottom-of-the-div-is-touching-the-bottom-of-the-browse

 

and then you need to attach the logic to the mousewheel event listener to prevent the goto slide functions from firing until it hits the bottom of an item. You'd probably also want to test it in reverse to be able to scroll up normally as well in these instances.

 

Another easier way might be to look at using scrollMagic and triggers to fire the scrolls as opposed to the current event listeners.

  • Like 5
Link to comment
Share on other sites

1 hour ago, Oksana Romaniv said:

This solution has a bug: when you scroll page by dragging the scrollbar and then scroll to using a wheel, the window will scroll to the next/prev section "in cache", not to the next/previous section based on the window scroll position.

 

Realistically you'd probably want to avoid having the scrollbar altogether for something like this. Something like this  on the body would do it overflow-y:hidden; 

 

 

See the Pen VRrpdR by Visual-Q (@Visual-Q) on CodePen

 

Otherwise you'd need to add some logic keeping track of where the slides are in the window when using the scrollbar to determine which slide the scroll actions want to target. 

 

NOTE this was only just a quick example of how you might address different sized sections, to make it production ready you'd need to examine all the possible interactions and points of potential failure and add the logic to counter them. 

 

 

  • Like 4
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.
×
×
  • Create New...