CSS平滑过渡动画:transition
2017-04-06 09:03
633 查看
<html> <head> <link href="http://cdn.bootcss.com/twitter-bootstrap/3.0.2/css/bootstrap.css" rel="stylesheet"> <style> body{ margin-top: 30px; } .box { width: 400px; padding: 15px; background-color: #f0f3f9; } .content { height: 0; position: relative; overflow: hidden; -webkit-transition: height 0.6s; -moz-transition: height 0.6s; -o-transition: height 0.6s; transition: height 0.6s; } .content img { position: absolute; bottom: 0; } .block{ margin: 20px 20px 20px 0; width:100px; height:100px; background:blue; transition:background 2s, width 2s; } .block:hover{ width:300px; background:red; } </style> </head> <body> <div class="container"> <div class="block"></div> <a href="javascript:" class="btn btn-primary" id="button">点击展开图片</a> <div id="more" class="content"> <img src="http://i1.hoopchina.com.cn/u/1403/26/425/2709425/3076ecc2.jpg" height="191" /> </div> </div> <script> (function() { var Btn = document.getElementById("button"), More = document.getElementById("more"); var display = false; Btn.onclick = function() { display = !display; More.style.height = display? "192px": "0px" return false; }; })(); </script> </body> </html>
相关文章推荐
- 基于ReactCSSTransitionGroup实现react-router过渡动画
- Transit – 超平滑的 CSS 过渡和变换动画效果插件
- 制作动画平滑过渡效果:《CSS3 Transition》
- CSS过渡动画之transition
- CSS的过渡效果及动画效果:transition&animation
- css3 transition 实例及分析 图片hover出现文字 sidebar平滑过渡(动画系列3)
- css transition动画效果案例
- Swift学习笔记(1)过渡动画(CATransition和UIViewAnimation)的用法
- 【CSS3】动画--过渡属性 transition-property
- 从零开始前端学习[33]:Cs3中的transition过渡-animation动画
- css 动画效果 -- transition
- 【CSS】过渡、动画和变换
- Vue学习之路(七)---transition过渡动画
- HTML和CSS高级指南整理翻译(08) 一 过渡与动画
- CSS动画 animation与transition
- CSS过渡和动画
- 【CSS3】transition过渡和animation动画
- css动画之过渡
- CSS-过渡效果和动画效果
- css3 Transition属性(平滑过渡菜单栏案例)