Jump to content
GreenSock

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

GSQP Draggable get scrollTop position on scroll event

Recommended Posts

Hi,

 

I use the Draggable plugin locked on the y axis to manage scrolling in a section. I would like to retrieve the y position of the scrolled element to trigger an event when reaching the end of the scroll area. It's working as follow when the user drag but not when he use the mouse wheel for ex.

 

Draggable.create(Pr, {
  type: 'scrollTop',
  ...
  onDrag: function(e) {
    type: 'scrollTop',
    this.update()
    console.log(this.y)
  }
})

 

How can I get a unified way to retrieve the y position between the different events, drag, scroll, etc.

Link to post
Share on other sites

Hm, a codepen would really help (just the absolute basic setup). Your code looks a bit odd to me (like the type:"scrollTop" inside your onDrag function, and I don't know why you're calling update() in there either). Draggable itself is for dragging - it doesn't track mousewheel interactions. It seems to me like you'd need to add your own listeners accordingly and snag the scrollTop in those events. But again, if you need some more help, just post a codepen demo and we'd be glad to take a peek. 

 

Happy tweening!

  • Like 2
Link to post
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.

×