Jump to content
Search Community

Draggable "snap" to target spot

cpkn_dev test
Moderator Tag

Go to solution Solved by OSUblake,

Recommended Posts

Currently I'm trying to use draggable to be able to move blocks onto target spots, and if the spot isn't "exact" it would adjust them to be exactly on top of the element. I've attached a minimal example

 

The part I'm getting stuck on is here:

 

                // move onto target
                gsap.to(e.target0.1, {
                  left: p.left,
                  top: p.top,
                  x: 0,
                  y: 0,
                });

 

My blocks seem to disregard this, I don't fully understand how to make one element "tween" ontop of another one. the values my console log provide seem accurate but it does nothing in draggable/gsap, it only remains on the spot I left it.

 

 

Any advice?

 

Thanks,

 

See the Pen PoWLJJQ by lsencabaugh (@lsencabaugh) on CodePen

Edited by cpkn_dev
New codepen
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...