Created
June 7, 2012 14:54
-
-
Save crazy4groovy/2889223 to your computer and use it in GitHub Desktop.
simple CSS3 fade-in/out transition
This file contains hidden or 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
| <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