简体   繁体   English

具有初始CSS属性值的过渡

[英]Transition with initial css attribute value

Suppose I have the follow transition on height attribute - 假设我对height属性进行了以下转换-

.testDiv {
    height : 400px ; 
    -webkit-transition: height 2s,  -webkit-transform 2s; /* For Safari 3.1 to 6.0 */
    transition:  height 2s, transform 2s;
}

.testDiv.hide {
    height : 0px ;
} 

Here is its jsFiddle demo 这是它的jsFiddle演示

Now , I want to get the same transition - from height 0px to 400px , but such that it would start with height:200px immediately and will make animation on its rest - (from 200px - 400px ) , 现在,我想获得相同的过渡-从height 0px400px ,但是这样它将立即从height:200px开始并在其其余部分上制作动画-(从200px - 400px ),

ie - 即-

  1. on start - height:0px 开始时- height:0px

  2. once clicked - 一旦点击-

    2.1 height:200px immediatly 2.1 height:200px立即height:200px

    2.2 height:200px to height:400px with transition . 2.2带有过渡的height:200pxheight:400px

How to get it ? 如何获得?

Add min-height 添加min-height

min-height: 200px;

http://jsfiddle.net/8bbo9cfz/2/ http://jsfiddle.net/8bbo9cfz/2/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM