Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Making an item draggable

From: Creating Drag-and-Drop Functionality with Edge Animate

Video: Making an item draggable

Once you've added your own script library, you want to Open close parenthesis, end with a semi colon to complete this one line.

Making an item draggable

Once you've added your own script library, you want to take advantage of it, just like I've done over here. I'm adding the jQuery UI JavaScript file, that whole JavaScript library. In fact, right over here, under Stage, if I click on this little icon right here, I can open up the actions for the stage. And this is where I just did a quick check to make sure it's available before I start using it. That has an alert that I'm just going to remove. Because now I want to take advantage of this library specifically for these eyes. I want to make the eyes draggable.

So I want to reference the jQuery UI documentation when doing that. So I'm going to launch a browser. And on jqueryui.com notice right over here my interactions, draggable, droppable, all sorts of things we can do. In fact I'm going to select draggable. And you can see how you can drag around this box. And there's other capabilities such as constraining the movement, all sorts of different things you can do. So I encourage you to explore the API documentation, which is exactly what I'm doing.

In fact, as I scroll down, you can see all the various options, the methods. But you'll see quite simply, its just adding a .dragable. So going back into Edge Animate. Selecting my eyes, and again right down here this is just an easy way to open up the actions. This is the actions I have for mouse over. Now I don't want to play that animation, so I'm going to eliminate that part but what I am going to do is I'm going to type in sym. That's going to target that symbol. Dollar sign since it's jQuery and then the name of the symbol.

In this case it's going to be eyes. And then .draggable. Open close parenthesis, end with a semi colon to complete this one line. And with that done, I will save this page and preview it in a browser. For the eyes, as I click on the eyes you can see how I can move them around. Easy enough, I could do the same thing for the mouth as I roll over that mouth that has functionality involved with it. So how would I take advantage of dragable there? Well it's pretty much the same deal.

In fact, I can go back into the eyes and it's going to be this same line. So I'm going to select it, Cmd+C to copy or Ctl+C if you're on a PC. Going to my mouth right here. Selecting the Open Actions button there. And rather than playing those two timelines I'm just going to paste in that line that I copied and change this to mouth. Easy enough. Doing a Cmd+Enter, Ctl+Enter, if you're on a PC. I can now drag around the mouth as well as the eyes. But there's additional functionality available as well, in fact, as I go back into jqueryui.com/draggable, right down in here you can start to see the different things you can do.

In fact, I want to actually change the opacity. So as I click on it I want to give an indication that I'm dragging it around. As well as I want to revert back to its original position. So I'll select opacity. And you can see it's this simple. It'll make it 35%. So I'll copy that line. As I'll scroll down you can see the revert. I'm going to take advantage of that as well. But let's start with opacity. By selecting my eyes. Opening up the Actions for it.

Right in those parentheses. Pasting that in. Opacity, 35%. And then I want to do a comma and this is where I'll add my revert. If we go back to our browser, we'll take a couple different parameters. You'll have basically true, invalid, valid or true. And I want to do invalid. If it's not dropped on a droppable item, then put it back in its place. Revert invalid. That's what I'm going to go with. Right in here. And in quotes. Invalid.

So, it'll change opacity and should, as I run this again, it should actually go back to its original position. So there's my opacity change, as I release, it goes back into it's original position. That's excellent in fact, I'm going to do this once more. Specifically for the mouth. Taking those same, parameters, right in here, copying them. For my mouth, pasting them in and now as I save this and I run it.

I now have two elements that I can drag. Around and as I release they go back into their original location. So I encourage you to try that out for yourself as well as explore the additional functionality options, methods, and events that are available thanks to the JQuery UI draggable capabilities.

Show transcript

This video is part of

Image for Creating Drag-and-Drop Functionality with Edge Animate
Creating Drag-and-Drop Functionality with Edge Animate

19 video lessons · 1207 viewers

Paul Trani
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating Drag-and-Drop Functionality with Edge Animate.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.