Jump to content
Search Community

Scroll wheel question

vencule 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 vencule,

 

Welcome to the forums!

 

Just to clarify: when you say "have active scroll" - what do you mean? That has scrollable content inside it? Or that it scrolls on its own?

 

What Chrysto has done in this pen is attach a mouse wheel event on the window object (are you familiar with said object?) - So, no matter where you use the mouse wheel it will get hijacked. If you want to have scrollable content inside of this implementation, will have to check if the mouse is scrolling inside of your nested scrollable div or not. If it is inside your scrollable nested div, you need to stop Chrysto's code from hijacking it.

 

  • Like 2
Link to comment
Share on other sites

Hello Dipscom,

Thanks for your replay!

 

Quote

If you want to have scrollable content inside of this implementation, will have to check if the mouse is scrolling inside of your nested scrollable div or not


Yes! This is exactly what I wish to accomplish just don't know how :(

Link to comment
Share on other sites

Wellllll.... This is not really  GSAP related is it?

 

But I think we can get away with a simple tip. Let's hope we don't get into trouble for it.

 

So, as I said, you have to know on top of which element your mouse is. Look at this code, it does not use jQuery, as I know nothing of jQuery. It will be your homework to make it work with jQuery if you decide to use it.

 

See the Pen c0a0a9f740fd4a1feed04b3748ba91b5 by dipscom (@dipscom) on CodePen

 

You should read into event capturing & bubbling. For more details.

  • Like 5
Link to comment
Share on other sites

Thank you :)

I was trying to accomplish something like that without success... I don't have full functionality, so I was thinking that there is some solution that I cannot see!
 

if(delta < -1)
{
  if( event.target.id === 'custom') {
    TweenMax.to("#custom", 2, {scrollTo:"max"});
    return;
  }
  goToNextSlide();
}


This is working but not always... 
Anyway... I will try to figure out what is the problem!

Thanks again :)

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