Search the Community
Showing results for tags 'gsap draggable'.
-
I have been trying to use draggable to create a swap effect using various tutorials and examples found here. If you take a look at the codepen, the ondrop function basically needs to complete the swap: 1. The dragged element should move to the position pf the dropped element 2. The dropped element should move to the dragged elements starting position http://codepen.io/chrismcnally/pen/aNMVwQ I have tried a few things but i fear i am going about it the wrong way Id appreciate it if someone could point me in the right direction Thanks
-
Since my example code is so simple I thought it might be best to just lay it out here rather than use codepen. When I run the following code in firefox I get no error message but it doesn't drag either, in Chrome I get 2 errors: Uncaught SyntaxError: Unexpected token < dragTest.html:20 Uncaught ReferenceError: Draggable is not defined(anonymous function) @ dragTest.html:20 Here is my code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>drag test</title> <style type="text/css"> #smallBox { position: absolute; width: 100px; height: 100px; background-color: red; } </style> </head> <body> <div id="smallBox"></div> <script src="gs/min/utils/"></script> <script> Draggable.create("#smallBox"); </script> </body> </html>
-
Hi there, Thanks for updating Draggable so quickly - works great in IE now My current problem is that I've got 5 DOM elements that are being made Draggable. I was hoping that I could call a function using onDragStart and by passing through the parameters [this.target], I would be able to manipulate the DOM element that is currently being dragged. However, whenever I console.log out this.target - no matter what DOM element is being dragged - the return is always the last draggable element (i.e. 'drag_5'). Whilst I understand that Draggable can consist of an array of draggable elements, is there any way that I can identify which element is currently being dragged by using either something like [this.target] or by spitting out its position in the Draggable array? Cheers in advance