Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Element.Events.clickout = {
base : 'click',
condition : function(event){
event.stopPropagation(); // stop event bubbling to the body
return false; // never run handler when clicking on element
onAdd : function(fn){
this.getDocument().addEvent('click', fn);
onRemove : function(fn){
this.getDocument().removeEvent('click', fn);
Please see for more info:
To see it in action:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.