jQuery .mousestop() Event Plugin

Jul 03 2013

jQuery Plugin JavaScript

It’s not very often we think about triggering a stop event over an element. But perhaps that is because the event has never existed in JavaScript. Actually the first time I came across ever needing a mousestop event was when I was building my jQuery Tooltip Plugin. I was attempting to closely mimic the browsers default behavior and noticed that the title tooltip that appears on elements only comes after the mouse stops moving.

I wanted to create this for my tooltip as well so I ended up writing this simple little mousestop event plugin for jQuery. It takes advantage of the jQuery Special Events API which allows you to add events right into the fabric of jQuery. This means we can bind the events using on and bind as well as trigger it using trigger or calling mousestop on an element.

This little event plugin is only ~1Kb minified and works just like all the other mouse events in jQuery allowing you to method chain them to an element and set a callback for the event. Check out the documentation for more info on usage.

Related


Websanova © 2017  
   
Powered by LaraBlog