Skip to content

Instantly share code, notes, and snippets.

@devatrox
Created May 16, 2014 15:13
Show Gist options
  • Save devatrox/5230f7118dc75a12ed27 to your computer and use it in GitHub Desktop.
Save devatrox/5230f7118dc75a12ed27 to your computer and use it in GitHub Desktop.
clickToggle
$.fn.clickToggle = function(a,b){
return this.each(function(){
var clicked = false;
$(this).bind('click',function(){
if (clicked) {
clicked = false;
return b.apply(this,arguments);
}
clicked = true;
return a.apply(this,arguments);
});
});
};
@followconsience
Copy link

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment