Created
May 16, 2014 15:13
-
-
Save devatrox/5230f7118dc75a12ed27 to your computer and use it in GitHub Desktop.
clickToggle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.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); | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much!