Jump to content
GreenSock

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

Horizontal and Vertical Scroll

Recommended Posts

Hello,

I am trying to add horizontal and vertical scroll. 

First four slide should scroll horizontally and last slide should scroll vertically. In first 4 slides I don't have much content but in last slide I have lot of content so I need to add vertical scroll for the last slide.

Right now until 5th slide its working okay even I can scroll vertically too. but when I go to bottom of the 5th slide and try to scroll to top the the 5th slide it's going to previous slide means 4th slide instead of going to top of the 5th slide.

 

Can you please help? I tried but its not working.

 

Thanks in advance

See the Pen rNzaBOj by swatiparge (@swatiparge) on CodePen

Link to comment
Share on other sites

Hi Swatip,

It would be really handy if you just included the specific part you need help with as there's over 250 lines of JS here.


I've dug through and it looks like you'll need to write some custom logic for the fifth slide.
 

if(slideFrom[0].id = "slide05") {
  // do some custom logic!
} else if(sectionToIndex != 0) {
  slideTo = slides.eq(sectionToIndex - 1);
  moveToSlide(slideFrom, slideTo);
}

 

See the Pen YzxPGKG?editors=0011 by GreenSock (@GreenSock) on CodePen

 

You could maybe use scrollTrigger to find out when the scrolled content is at the top and only then fire off the moveToSlide function?

Delving into custom JS logic is a little out of the scope of these forums but I hope this set you in the right direction.

 

If you have questions about scrollTrigger we're happy to help!

  • Like 2
Link to comment
Share on other sites

Thank you so much. 

  • Like 1
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.
×