Okay, now let's take a look at the interactions and effects in jQuery UI. Now remember interactions and effects are not widgets. You don't add these to your page; what you do is you apply these behaviors to things that are already in your page. So, let's begin by looking at the Interactions section, and I am going to click on Draggable. Now I want to point out again that the way the pages laid out is very similar to the layout for widgets. So, here's the example. Over here on the right-hand side are various options you can try out.
If you scroll down, there's a view source option, and of course there's a link to the API documentation. So, beginning with the Draggable interaction, you can see that when I click on this div, I can drag it around, all right. Now this is a div I already have in my page and I've simply applied the interaction of being draggable to it. And I can also do things like constrain movements. So for example, this one can only be dragged vertically. This one can only be dragged horizontally. This one over here is only draggable within its parent.
This one here is within this containing box right here. There are various different things you can do. You can have handles. Here's one that can only be dragged by its handle. When you click somewhere else, you can't drag it. All right! You can drag this around, but you can't drag by this handle for example. So, Draggable is a behavior that you can apply to things that are in your page. Let's take a look at another example. There is Resizable. We're going to be using Resizable in our real-life website, when we build it later in the course.
So, again you can see that Resizable, when the Resizable interaction is applied to an element, this little resize handle appears down in the bottom of the element, and I can just drag on that and resize it. I can also do things like constrain the resize area. So for example, I can't resize outside this parent. I can have a maximum and minimum size, so I can't make it any bigger than that. I can't make it any smaller than that. There are different things I can, do things like animations. So I can drag out a little ghost image, and then it grows into my resizable area.
Again, you get the idea. I am not going to go through all these, because they're pretty exhaustive, but the idea is that these are behaviors that you apply to things in your page. They're not predefined user interface, the way that things look; you simply say, I want to make something resizable or draggable or droppable and then you apply the jQuery UI behavior just like you would apply any other kind of behavior in your code. Let's scroll down over to the effects. Let's take a look at the Color Animation effect. So, I am going to go ahead and toggle the effect, and you can see that jQuery UI provides a way of animating not just things like size and position, but animating color, and this is something that jQuery itself does not provide out of the-box.
So, if you want to animate between two colors, you can use the Color Animation effect. There are also various other effects you can use in jQuery UI. Let's take a look at the Show effect. Now again, jQuery itself provides effects for things like showing and hiding and fading and so on, but you can see here that jQuery UI provides a whole bunch of other effects. So, for example there's the Blinds effect, where it comes in as if you're dropping blinds. Here's the Bounce effect. It bounces into place. Here's the Explode effect, which kind of explodes into place.
Here's the Pulsate effect. You get the idea. There's a whole bunch of prebuilt effects that you can use in your pages. And so once again, if we click on the view source, you'll see that using the effects is really very simple. You simply use the Show method with the effect that you want to have applied to the element. So, just like widgets, you can use interactions and effects to apply really professional-looking UI to your web pages.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 97456 Viewers
61 Video lessons · 84687 Viewers
71 Video lessons · 68887 Viewers
56 Video lessons · 101331 Viewers
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.
Your file was successfully uploaded.