Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
JGM.io

Draggable element not snapping

Recommended Posts

I'm trying to build a slide-out menu in an app that runs within an SVG tag and everything works except the grid snapping.

 

Codepen

 

I've tried using console.log(endValue) where the Codepen says alert() but it doesn't seem to get triggered. I was thinking that maybe snap was a feature inherited by the ThrowPropsPlugin (not using that) but I wasn't sure.

 

The idea is that the menu element (#testE) can slide halfway out of screen OR fully visible.

 

 

See the Pen XJpZBw by JGMio (@JGMio) on CodePen

Link to comment
Share on other sites

It looks like you just need to change "snap" to "liveSnap". "snap" is for snapping the end position when you're using throwProps (after the user flicks and a tween begins)

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