Simple jQuery Click Outside Plugin - clickout.js

Simple jQuery Click Outside Plugin - clickout.js
File Size: 5.76 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

clickout.js is an ultra-light jQuery plugin which allows to detect and fire an event when you click outside of an elements scope. Great for dropdown menu & modal window projects.

See also:

How to use it:

1. Include the JavaScript file jquery.clickout.js after you've included jQuery library.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="src/jquery.clickout.js"></script>

2. Attach the click outside event to a specific element:

$('.box').on('clickout', function(){
  // do something
});

3. Or trigger the click outside event as a callback as this:

$('.box').clickout(function(){
  // do something
});

This awesome jQuery plugin is developed by emn178. For more Advanced Usages, please check the demo page or visit the official website.