Skip to content

Instantly share code, notes, and snippets.

@markshust
Created December 27, 2016 17:05
Show Gist options
  • Select an option

  • Save markshust/2d112a8a6fe1e845854ce2e694147d52 to your computer and use it in GitHub Desktop.

Select an option

Save markshust/2d112a8a6fe1e845854ce2e694147d52 to your computer and use it in GitHub Desktop.
jquery helper to replace deprecated jquery.toggle click event
$.fn.toggleClick = function () {
var functions = arguments;
return this.each(function () {
var iteration = 0;
$(this).click(function () {
functions[iteration].apply(this, arguments);
iteration = (iteration + 1) % functions.length;
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment