主页 > 前端 > javascript >
来源:未知 时间:2016-12-14 13:35 作者:xxadmin 阅读:次
[导读] js直接操作css3属性transition/webkitTransform实现动画代码实现 !--webkfa.com--!DOCTYPEhtmlhtmlheadmetacharset=utf-8/metaname=apple-touch-fullscreencontent=YES/metaname=viewportcontent=width=device-width,initial-scale=1.0,minimum...
js直接操作css3属性transition/webkitTransform实现动画代码实现 <!-- webkfa.com --> <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta name="apple-touch-fullscreen" content="YES" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="format-detection" content="telephone=no" /> <title>js直接操作css3属性transition和webkitTransform实现动画</title> </head> <body> <input type="button" value="往下" onclick="xia(100);"/> <input type="button" value="往上" onclick="shang(0);"/> <div style="width:50px;height:50px;background:red;" id="webkfaid"></div> <script type="text/javascript"> function xia(sum){ var obj=document.getElementById("webkfaid"); obj.style.transition="-webkit-transform 500ms ease-out"; obj.style.webkitTransform="translate(0px,"+sum+"px) scale(1) translateZ(0px)"; } function shang(sum){ var obj=document.getElementById("webkfaid"); obj.style.transition="-webkit-transform 500ms ease-out"; obj.style.webkitTransform="translate(0px,"+sum+"px) scale(1) translateZ(0px)"; } </script> </body> </html> |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com