Last active
August 29, 2015 14:02
-
-
Save joelremix/e03bce1f708583d73e98 to your computer and use it in GitHub Desktop.
jQuery: nextStep
This file contains 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.nextStep = function(step) { | |
elem = this.parent().children().eq(this.index() + step -1 -(this.index()%step)); | |
return elem.length ? elem : this.parent().children().last(); | |
}; |
This file contains 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
http://stackoverflow.com/a/18444288/372567 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment