From the course: Adobe Captivate: Extending with JavaScript

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Combining JavaScript and drag-and-drop: Part 1

Combining JavaScript and drag-and-drop: Part 1 - Captivate Tutorial

From the course: Adobe Captivate: Extending with JavaScript

Combining JavaScript and drag-and-drop: Part 1

- [Instructor] Drag and drop interactions are popular and random numbers introduce an element of chance into a project. So let's combine them, what's not to love? So here, we're going to use a JavaScript generated random number to control the behavior of a drag and drop interaction, I think you're going to like it. So, let's preview the completed piece so you can see what we're building toward. So, here we drag the image to the correct step in the olive oil making process. Now you'll notice the way that we've set this up is that if you drag the image to the wrong step, it just bounces back and you can try again. If you drag it to the correct spot or close to the correct spot, it sticks. And once you've got one step placed correctly, you can see that another one appears, and we can drag this one to the correct spot, and so on until all of them are in the correct place. When we're done, we get a little success caption…

Contents