eventPause.js
eventPause is a tiny plugin with lots of methods to control events. So whenever you want you can pause and activate any event.
jQuery gave us many way to bind events and unbind it.
But there some situation comes where we just want to pause event (or say unbind it temporally). For that we unbind events and bind it again when we need.
But this become painful on binding event again when there is no reference of event handler or you don’t have its scope, or you just don’t know what event handlers are assigned to a particular event.
Demo :http://ignitersworld.com/lab/eventPause.html
Plugin Methods
Method | Description |
pause | Pause an event or group of event of element . |
active | Active events of a element. |
pauseChild | Pause events of that element along with events of all its descendants elements. |
activeChild | Active events of that element along with events of all its descendants elements. |
toggle | toggle the current state of a element (active to paused , paused to active) |
enable | Enable the element to change the current state. (does not accept second argument) |
disable | Disbale the element to change the current state.(does not accept second argument) |
state | Give current state of element. It will return four combination ex: paused-enabled means event is paused and state change in enabled. (does not accept second argument) |
Global Methods
Method | Description |
activeAll | Active all elements which are paused using eventPause plugin. |
enableAll | Enable all the element(in which eventpause plugin is used) to chnage the current state. |
disableAll | Disable all the element(in which eventpause plugin is used) to chnage the current state. |
Plugin Methods Example
Calling without any parameter.
$('.selector').eventPause();
It will activate pause mode for all events of selector.Calling with only event list
$('.selector').eventPause('click hover');
It will activate toggle mode for click and hover event.Calling with only method
$('.selector').eventPause('pause');
It will activate pause mode for all events of selector.**Other method are also called in same way.
Calling with method and event list
$('.selector').eventPause('pause','click hover');
It will activate pause mode for click and hover event.** enable,disable and state method does not accept second argument.
Global methods example
Calling global method
$.event.activeAll();
Global method does not accept any argument.