Viewers: in countries Watching now:
Drag-and-drop functionality is perfect for any game or interactive web project. Edge Animate makes it easy to implement. Plus, the drag-and-drop interactions you add work even on smartphones and tablets. Learn how to create draggable objects, add target areas where users can drop them, create reactions to those drops, and change content and object positioning accordingly. Author Paul Trani walks you through each step of the process in this project-based course.
If you are targeting mobile, of course you need to test out on mobile devices. Now, here I have this project posted to paultrani.com that's the URL. And I'm just going to go ahead and play around with this on my iPhone and I'll try to click and drag the eyes. As I do you can see it, it actually just selects the eyes and that's not what I want. So this is not optimized for mobile. I need to convert these mouseovers and mousedowns into touch events. And what I can do in order to make that happen is use something called Touch Punch.
So, launch your browser and go to touchpunch.furf, F-U-R-F .com. And, here, you'll see this actually gives the ability to take jQuery UI and convert into touch-enabled functionality. And, you can see, right down here, it says that it works by mapping the touch events to mouse events. And that is what going on. So I don't have to write these touch events, I could use this small library. I do encourage you to donate. In essence what you want to do is use you want to use this particular file.
Again, it's going to take, you know, some mouse downs, it might not do the mouse over, so it does what it can, but really it's dealing with the jQuery UI functionality. So I could test this out, not quite everything will work. Because this mouseover actually doesn't work. What I want to do, is I actually want to take this code right here and I want to copy it, because I'm going to add a new one, that's called TouchStart. This will give me the ability to drag and drop that item on mobile devices.
So we can do that for the eyes, we can do that for the ears, again the same process taking mouseover, copying it, adding touchstart, pasting it in, just like that. And we will do one more item. This mouth here, mouseover, taking those lines, adding touchstart, pasting it in. So, I've added some touch enabled functionality. And, not only that, I have my touch, punch, added as well, so I can Publish this out, upload it, and then test it on my mobile device again.
Here I am, back on my mobile device, and now if we take those eyes for instance, just with my finger, I can grab and touch it and move it around. The depth looks good, dropping them on the monster body. The ears, grabbing them and then placing them on the head. And lastly, it's going to be that mouth. Grabbing that mouth, placing it right over here. All right, there we have it. And keep in mind, with touch punch, all of my clicks will actually be interpreted as touch events. So if I take a look at this PLAY button, this PLAY button as I click it, you could see the animation takes place.
All right. So far, so good. I'd say, actually, this is pretty much done. I can test it on more devices. But, in general, there's your project complete, working on mobile. And, lastly, don't forget that there's other events that you can do, specific to mobile. Like, swipes that are actually built into Edge Animate.
There are currently no FAQs about Creating Drag-and-Drop Functionality with Edge Animate.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.