Jump to content
GreenSock

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

Looping draggable that snaps without throwProps

Recommended Posts

I'm trying to make a looping Draggable that snaps and only moves one step at a time.

 

The problem is that with throwProps switched on, the user can throw it more than one 'step' at a time, and with throwProps switched off it doesn't snap at all.

 

I used this pen as a starting point:

See the Pen ee107aeb54bdf4dca1084715d86b5e9c by osublake (@osublake) on CodePen

 

Here's where I've gotten to:

 

Any help greatly appreciated.

See the Pen mWQoye by lewisSME (@lewisSME) on CodePen

Link to comment
Share on other sites

Sorry for the late response - is this what you're looking for?:

http://codepen.io/GreenSock/pen/5ab2ffbfe42ba91d4e90a5fe16e8cf93/

 

It limits things to one position left/right. I also reworked some of the logic so that it handles resizes of the window appropriately (well, you could certainly enhance it further, but the basics are there). 

 

Does that help?

  • Like 3
Link to comment
Share on other sites

Thanks so much, that's exactly what I was after :)

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