Skip to content

eventPause is a tiny plugin with lots of methods to control events. So whenever you want you can pause and activate any event.

License

Notifications You must be signed in to change notification settings

s-yadav/eventPause.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

So this plugin will help you there and will give control on events in better way.



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)

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.


eventPause accept two parameter 1st method and 2nd events(multiple event space seperated) where both or optional. We will see some combination of way in which we can use this plugin.

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.

About

eventPause is a tiny plugin with lots of methods to control events. So whenever you want you can pause and activate any event.

Resources

License

Stars

Watchers

Forks

Packages

No packages published