jQuery Plugin To Trigger A Function When Click Outside An Element - outclick

File Size: 6.24 KB
Views Total: 3428
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Trigger A Function When Click Outside An Element - outclick

outclick is an ultra-light jQuery plugin (~2kb minified) which detects and executes a callback function when your user clicks outside of a given element. 

How to use it:

1. Make sure to load the jQuery outclick.js script after jQuery library but before you close the body tag.

<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>
<script src="outclick.min.js"></script>

2. Trigger a custom callback function when you click outside of the element 'target'.

$('.el').outclick(function() { 
  // do something
}

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