1234567891011121314151617181920212223242526272829303132333435363738 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <style>
- #div1{
- width: 200px;
- height: 200px;
- background: red;
- /* 过度 属性 执行时间 运动的方式 延迟时间 */
- transition: width 2s linear 2s;
- /* transition-property */
- /* 设置对象中参与过度的属性 */
- /* transition-duration */
- /* 设置对象过度的持续时间 */
- /* transition-timing-function*/
- /* 设置对象中过度的类型 */
- /* transition-delay */
- /* 设置对象延迟过度的时间 */
- }
- </style>
- </head>
- <body>
- <div id="div1"></div>
- <button id="btn1">btn</button>
- <script>
- var btn = document.getElementById('btn1')
- var div1 = document.getElementById('div1')
- btn.onclick = function(){
- div1.style.width = 500 + 'px'
- }
- </script>
- </body>
- </html>
|