日期:2014-05-17 浏览次数:20752 次
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <script type="text/javascript" src="js/jquery.js"></script> <title>Flip Text</title> </head> <body> <div id="cover"> <div id="coverText"> <div id="welcomeStr1">Welcome To HTML5!</div> <div id="welcomeStr2">Hello World!</div> </div> </div> </body>
*{ margin:0px; padding:0px; } #cover{ position:absolute; width:100%; height:100%; min-width: 768px; overflow: hidden; background: -webkit-gradient(linear,left top, left bottom, color-stop(0, #00BDF2), color-stop(1, #003D7B)); background: -moz-linear-gradient(top,#00BDF2, #003D7B); }
#coverText { position: absolute; left: 18%; top: 30%; width:64%; text-align:center; } #welcomeStr1,#welcomeStr2 { height: 86px; font-size: 64px; line-height: 86px; letter-spacing: 2px; color: white; font-family:"Courier New"; -webkit-animation-time-function: linear; }
@-webkit-keyframes flip { 0% { -webkit-transform: rotateY(0deg) scale(1,1); color: white; } 70% { -webkit-transform: rotateY(0deg) scale(1,1); color: white; } 100% { -webkit-transform: rotateY(90deg) scale(0.6,0.7); color: #3C4043; } }
-webkit-animation: flip 5s infinite; -webkit-text-size-adjust: none;
@-webkit-keyframes unflip { 0% { -webkit-transform: rotateY(90deg) scale(0.6,0.7); color: #3C4043; } 100% { -webkit-transform: rotateY(0deg) scale(1,1); color: white; } }
flip = function(element, flipName, flipTime, unflipName, unflipTime) { if(!element){ return; } element.style.webkitAnimation = "" + flipName + " " + flipTime; return $(element).bind('webkitAnimationEnd', function() { switch (element.style.webkitAnimationName) { case flipName: return element.style.webkitAnimation = "" + unflipName + " " + unflipTime;break; case unflipName: return element.style.webkitAnimation = "" + flipName + " " + flipTime;break; } }); };
$(function() { flip($("#welcomeStr1")[0], 'flip', '1.5s', 'unflip', '0.7s'); flip($("#welcomeStr2")[0], 'flip', '1.5s',