Share Posted January 16, 2019 Hello GreenSock community, I'm trying to implement one functionality opposite to drag and drop. I want to select div on single click and place it on click on any empty place boxes. So both things should be done by using single mouse click. Can anyone guide how can I achieve this using GreenSock. Thanks in advance. See the Pen qLvQbO by LeoZoe (@LeoZoe) on CodePen Link to comment Share on other sites More sharing options...
Share Posted January 16, 2019 Hi @LeoZ, If the objects are next to or above each other, it can work that way. If a random placement is required, a bit of math and some conditions are needed ... See the Pen qLvLrp by mikeK (@mikeK) on CodePen Happy tweening ... Mikel 2 Link to comment Share on other sites More sharing options...
Author Share Posted January 16, 2019 Thanks Mike, Actually, it is started to moving on click but I want to select it on click and when I click on any empty box, then it will be moved into that box. Also, placement is random so I will try applying some math now. Also it would be great if you help me with that too. Link to comment Share on other sites More sharing options...
Share Posted January 16, 2019 Hi @LeoZ, I have no idea if something like this works with a double click (1st click: button selection, 2nd click: free field selection ??). Here a random version See the Pen LMawRe by mikeK (@mikeK) on CodePen Kind regards Mikel 2 Link to comment Share on other sites More sharing options...
Share Posted January 16, 2019 Hi @LeoZ And here is a variant for two clicks. However, very sensitive; the staggered buttons and the occupied places would still have to be blocked. See the Pen VqNpwr by mikeK (@mikeK) on CodePen Happy clicking ... Mikel Link to comment Share on other sites More sharing options...
Share Posted January 17, 2019 Hi, It did not let me go ... See the Pen PXveRy by mikeK (@mikeK) on CodePen Now its more or less safe. Mikel 2 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now