jquery 03 – Swapping images with mouse events

Shares

Views: 96 | Duration: 9:14
Likes: 0 | Dislikes: 0


So you want to hide or show an image because the mouse rolled onto something on the page? That’s a mouse event! There’s more than one kind, and unfortunately, there’s no toggle option for mousing in and out, or for pressing and releasing the mouse button. No worries — you can still make it work, as log as you know how to chain event handlers together.

Included:

mouseenter, mouseleave events
mousedown, mouseup events
.attr() method, to change the image

Code:

There is no code for this video. There are links to code in other videos in this series.

Links:

jQuery Event Basics https://learn.jquery.com/events/event-basics/
jQuery and HTML Attribute https://api.jquery.com/category/attributes/
jQuery Mouse Events https://api.jquery.com/category/events/mouse-events/

Subscribe to the JqueryPlugins.net mailing list:
* indicates required

Reply

Pin It on Pinterest