Skip to content

Instantly share code, notes, and snippets.

@DannyDelott
Last active August 29, 2015 14:16
Show Gist options
  • Save DannyDelott/610aa01b0be48a4c78bb to your computer and use it in GitHub Desktop.
Save DannyDelott/610aa01b0be48a4c78bb to your computer and use it in GitHub Desktop.
Fade out and change HTML, then fade back in.
var $content = $('.content');
var $container = $('.container');
var quotes = [ /* array of quotes */ ];
var randomQuote = function(){
return quotes[Math.floor(Math.random() * quotes.length)];
};
var changeQuote = function(){
$content.fadeOut('slow', function(){
$container.html(randomQuote());
$content.fadeIn('slow');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment