Jump to content
Search Community

Recommended Posts

TharunThabeti
Posted

Hi,

I'm trying to make a angular component with only horizontal scrolling on mouse activity. I've been trying this so long. But cannot do it. Any suggestions?

Posted

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)?

Posted

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.

TharunThabeti
Posted

Thanks for the demo Zach. I've got some important info. But I'm really confused about implementing this in angular. Any Idea?

TharunThabeti
Posted

I'm confused with the demo though! If possible can you break down into only mouse scroll up and down triggers? Because there are lot of things involved.

Thanks in advance

Posted
57 minutes ago, TharunThabeti said:

If possible can you break down into only mouse scroll up and down triggers? Because there are lot of things involved.

That's a good exercise for you to do :) 

  • Like 2

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