Created
December 27, 2016 17:05
-
-
Save markshust/2d112a8a6fe1e845854ce2e694147d52 to your computer and use it in GitHub Desktop.
jquery helper to replace deprecated jquery.toggle click event
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.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