ClickOut
Register clickout event in javascript
npm install clickout --save
Demo
Import
;
API
// Emit a 'clickout' event each time you click outside of a specific HTMLElement static : destroyClickOut; // Trigger a function only when you click outside of a specific HTMLElement static : destroyClickOut; // Destroy all listeners for emit/trigger clickout event/function static : void;
Examples
ClickOut.bindCustomEvent(element)
CustomEvent is supported in all major browsers. If you need support for old browsers check this polyfill.
const element = document; // Emit 'clickout' event when you click outside of elementClickOut; // Listen on 'clickout' event emitted from the elementelement // elsewhere on your codeelement
ClickOut.bind(element, onClickOut)
const element = document; // Trigger a function only when you click outside of a specific HTMLElementClickOut;
ClickOut.destroy(element)
Destroy bindCustomEvent
const element = document; ClickOut; element; ClickOut; /** * ------------------------------ * Is the same as: */ const destroyClickOutElement = ClickOut; element; ;
Destroy bind function
const element = document; ClickOut; ClickOut; /** * ------------------------------ * Is the same as: */ const destroyClickOutElement = ClickOut; ;