html+css+js实现时间滚动效果
工具/原料
adobedreamweaver
方法/步骤
1、新建html文档。
2、书写hmtl代艨位雅剖码。<p>现在是:</p><divclass=&quo墉掠载牿t;dowebok"><divclass="hours"></div><divclass="minutes"></div><divclass="seconds"></div></div>
3、书写css代码跷孳岔养。@-webkit-keyframesflipTop{0%{-webkit-tr锾攒揉敫ansform:perspective(400px)rotateX(0deg);}100%{-webkit-transform:perspective(400px)rotateX(-90deg);}}@-webkit-keyframesflipBottom{0%{-webkit-transform:perspective(400px)rotateX(90deg);}100%{-webkit-transform:perspective(400px)rotateX(0deg);}}@-moz-keyframesflipTop{0%{-moz-transform:perspective(400px)rotateX(0deg);}100%{-moz-transform:perspective(400px)rotateX(-90deg);}}@-moz-keyframesflipBottom{0%{-moz-transform:perspective(400px)rotateX(90deg);}100%{-moz-transform:perspective(400px)rotateX(0deg);}}@-ms-keyframesflipTop{0%{-ms-transform:perspective(400px)rotateX(0deg);}100%{-ms-transform:perspective(400px)rotateX(-90deg);}}@-ms-keyframesflipBottom{0%{-ms-transform:perspective(400px)rotateX(90deg);}100%{-ms-transform:perspective(400px)rotateX(0deg);}}@-keyframesflipTop{0%{transform:perspective(400px)rotateX(0deg);}100%{transform:perspective(400px)rotateX(-90deg);}}@-keyframesflipBottom{0%{transform:perspective(400px)rotateX(90deg);}100%{transform:perspective(400px)rotateX(0deg);}}.flipTimer{color:#FFF;font-family:"HelveticaNeue",Helvetica,sans-serif;font-size:90px;font-weight:bold;line-height:100px;height:100px;}.flipTimer.seperator{vertical-align:top;margin:0-20px;display:inline;}.flipTimer.seconds,.flipTimer.minutes,.flipTimer.hours,.flipTimer.days{height:100%;display:inline;}.flipTimer.digit-set{border-radius:10px;box-shadow:02px4pxrgba(0,0,0,0.8);border:1pxsolid#111111;width:70px;height:100%;display:inline-block;position:relative;margin:01px;}.flipTimer.digit{position:absolute;height:100%;}.flipTimer.digit>div{position:absolute;left:0;overflow:hidden;height:50%;padding:010px;}.flipTimer.digit>div.digit-top,.flipTimer.digit>div.shadow-top{background-color:#333;border-bottom:1pxsolid#333;box-sizing:border-box;top:0;z-index:0;border-radius:10px10px00;}.flipTimer.digit>div.digit-top:before,.flipTimer.digit>div.shadow-top:before{content:"";box-shadow:inset010px25pxrgba(0,0,0,0.4);height:100%;width:100%;position:absolute;left:0;top:0;}.flipTimer.digit>div.shadow-top{background:-webkit-gradient(linear,0%0%,0%100%,from(rgba(0,0,0,0)),to(black));width:70px;opacity:0;-webkit-transition:opacity0.3sease-in;}
4、书写并添加js蜣贺鱿柢代码。<scriptsrc="js/jquery-1.11.3.min.js"></script><s艘早祓胂criptsrc="js/jquery.fliptimer.js"></script><script>$(function(){$('.dowebok').flipTimer({seconds:true});});</script>
5、代码整体结构。
6、查看效果。