Skip to content

Instantly share code, notes, and snippets.

@Soupala
Created February 1, 2014 18:22
Show Gist options
  • Save Soupala/8756274 to your computer and use it in GitHub Desktop.
Save Soupala/8756274 to your computer and use it in GitHub Desktop.
A simple jQuery pattern for rotation through a series of html elements. Kind of like a carousel, but just for text or other overlays.
(function() {
var rotates = $(".rotatetext");
var rotateIndex = -1;
function showNextRotate() {
++rotateIndex;
rotates.eq(rotateIndex % rotates.length)
.fadeIn(900)
.delay(1800)
.fadeOut(900, showNextRotate);
}
$(document).ready(showNextRotate());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment