CSS平滑过渡动画:transition
<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>
CSS平滑过渡动画:transition的更多相关文章
- css3过渡动画 transition
transition CSS3 过渡是元素从一种样式逐渐改变为另一种的效果. 要实现这一点,必须规定两项内容: 指定要添加效果的CSS属性 指定效果的持续时间 例如 这是下面代码的预览界面预览界面 & ...
- css变换与动画详解
举个栗子:--------元素整体居中.box{ position:absolute;top:50%;left:50%; width:50px; height:50px; t ...
- transtion:过渡动画
p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Monaco; color: #4f5d66 } p.p2 { margin: 0.0px 0 ...
- 用js触发CSS3-transition过渡动画
用js触发CSS3-transition过渡动画 经过这几天的工作,让我进一步的了解到CSS3的强大,原本许多需要js才能实现的动画效果,现在通过CSS3就能轻易实现了,但是CSS3也有自身的不足,例 ...
- vue过渡动画
概述 Vue 在插入.更新或者移除 DOM 时,提供多种不同方式的应用过渡效果.包括以下工具: 在 CSS 过渡和动画中自动应用 class 可以配合使用第三方 CSS 动画库,如 Animate.c ...
- CSS过渡动画之transition
O(∩_∩)O~ 这两天在看看CSS的相关内容,关于transition动画感觉很有意思,分享一下. CSS负责给html加效果,自然少不了各种动画,今天介绍一下transition. 概述 看一段比 ...
- css3-12 transition+css或transform实现过渡动画
css3-12 transition+css或transform实现过渡动画 一.总结 一句话总结:首先要设置hover后的效果,然后在transition里面指定执行哪些样式和执行时间为多长. 1. ...
- css的过渡transition和动画animation
过渡 过渡(transition)是CSS3中具有颠覆性的特性之一,我们可以在不使用Flash动画或JavaScript的情况下,当元素从一种样式变换为另一种样式时元素添加效果.过渡动画:是从一个状态 ...
- 【CSS】过渡、动画和变换
1. 使用过渡 过渡效果一般是由浏览器直接改变元素的CSS属性实现的.例如,如果使用:hover选择器,一旦用户将鼠标悬停在元素之上,浏览器就会应用跟选择器关联的属性. <!DOCTYPE ht ...
随机推荐
- 桦仔------分享一下我研究SQLSERVER以来收集的笔记
http://www.cnblogs.com/lyhabc/p/3219117.html
- webrtc 视频 demo
webrtc 视频 demo webrtc网上封装的很多,demo很多都是一个页面里实现的,今天实现了个完整的 , A 发视频给 B A webrtc.html作为offer <!DOCTYPE ...
- View载入具体解释
文章一開始我要对前面一篇文章做点补充 相信大家都知道View有两个方法. public boolean post(Runnable action) public boolean postDelayed ...
- SQL经典面试题集锦
1.问题背景 (1)学生表(学号,姓名,年龄,性别) student(S#,Sname,Sage,Ssex) (2)课程表(课程编号,课程名称,教师编号) course(C#,Cname,T#) (3 ...
- MySQL create table as与create table like对照
在MySQL数据库中,关于表的克隆有多种方式,比方我们能够使用create table ..as .. .也能够使用create table .. like ..方式. 然而这2种不同的方 ...
- CoffeeScript里的or
CoffeeScript里的or,其实会被编译为 || 这并没有什么令人惊奇之处.我惊讶的是类似这样一个表达式: word = null hi = word or "Hello World! ...
- PHP数字左侧自动补零
1.输出数字为001,002... <?php $number=0; if($number<100) { $number=$number+1; $txt=sprintf("%03 ...
- # [libx264 @ 00000275eb57fec0] height not divisible by 2 (520x325)
# [libx264 @ 00000275eb57fec0] height not divisible by 2 (520x325)
- cookie知识点简点
cookie几大作用: 1.保持用户登陆状态 2.跟踪用户行为 3.制定页面 4.创建购物车 cookie缺点: 1. 可能被禁用 2.可能被删除:cookie是一个文件,easy被用户删除 3.安全 ...
- Api基类
基类 class BaseController extends Controller{ public $outData = ['code'=>0,'msg'=>'ok']; public ...