Skip to content

Instantly share code, notes, and snippets.

@peteroome
Created September 26, 2009 12:52
Show Gist options
  • Select an option

  • Save peteroome/194216 to your computer and use it in GitHub Desktop.

Select an option

Save peteroome/194216 to your computer and use it in GitHub Desktop.
The Javascript used to make each item in the given list fade in and out.
$(function(){
$('body').removeClass('js-disabled').addClass('js-enabled');
$('#quotes').flashQuotes();
});
$.fn.flashQuotes = function(){
return this.each(function(){
var quotes = $('>li',this);
quotes.not(':first').hide();
var timer = window.setInterval(function(){
quotes.filter(':visible').fadeOut(function(){
if ($(this).is(':last-child')) {
quotes.eq(0).fadeIn();
} else {
$(this).next('li').fadeIn();
}
});
},3000);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment