Jump to content
Search Community

Angular Horizontal scroll for specific component

TharunThabeti test
Moderator Tag

Recommended Posts

Hey Tharun and welcome to the GreenSock forums!

 

There are a few different ways you can set this up. The easiest general technique would probably be to animate an element's x property when needed. Can you please 1) describe in more detail the exact effect that you're looking to create (i.e. how the horizontal scroll should work) and 2) please provide a minimal demo of your approach so far (it'd probably be better if your example didn't use Angular but was just in a CodePen or something - then you could move it to Angular later)?

Link to comment
Share on other sites

Hey Tharun,

 

If you remove the event.preventDefault() line that's causing the error you can see that your code works. It performs really terribly because you are creating a new tween every scroll event (which usually happens hundreds of times per section change) but you can fix that by checking TweenMax.isTweening(window); before creating new scroll tweens like I did in the demo below:

See the Pen gOOyyzQ?editors=0010 by GreenSock (@GreenSock) on CodePen

 

However it might be best to just use a horizontal scroller like the one below because it solves most of your issues for you:

See the Pen YRzRyM by PointC (@PointC) on CodePen

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