Skip to content

Instantly share code, notes, and snippets.

@crazy4groovy
Created June 7, 2012 14:54
Show Gist options
  • Select an option

  • Save crazy4groovy/2889223 to your computer and use it in GitHub Desktop.

Select an option

Save crazy4groovy/2889223 to your computer and use it in GitHub Desktop.
simple CSS3 fade-in/out transition
<html>
<head>
<!-- fades well in Firefox and Chrome, hide/show only in Opera, no animation in IE 8 (?) -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<style>
#content {
opacity: 0;
-moz-transition: opacity .5s ease-in-out;
-webkit-transition: opacity .5s ease-in-out;
transition: opacity .5s ease-in-out;
}
#content.faded-in {
opacity: 1;
}
</style>
<script>
$(function() {
setInterval(function() {
$('#content').toggleClass('faded-in');
}, 2000);
})
</script>
</head>
<body>
<div id="content">
Hello there
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment