【发布时间】:2016-10-06 07:21:26
【问题描述】:
我有这个广场:https://jsfiddle.net/34f93mL3/
如您所见,当您将鼠标悬停在它上面时,顶部会向下折叠,当它到达底部时,它会变成圆点粉红色。
但是,我希望它模仿实际的折叠动作,这意味着它不应该有 polkadots,直到它“折叠”更多一点。
这里是完整的代码,它只使用了 HTML 和 CSS:
body {
background: white
}
#slow-container {
top: 100px;
left: 200px;
height: 50px;
position: absolute;
width: 100px;
background: lightblue;
}
#slow-container:before {
top: -50px;
height: 50px;
position: absolute;
width: 100px;
background: lightblue;
}
#slow-container2 {
top: -50px;
height: 50px;
position: absolute;
width: 100px;
background: lightblue;
}
.slow-parent1 {
height: 0;
overflow: hidden;
background: lightgreen;
}
.slow-parent2 {
background: white;
}
.slow-parent3 {
height: 300px;
background: red;
}
#slow-container2 {
transition: all 1s linear;
transform-origin: bottom center;
}
#slow-container:hover #slow-container2 {
transform: rotateX(180deg);
background-color: lightpink;
background-image: radial-gradient(#fff 10%, transparent 10%), radial-gradient(#fff 10%, transparent 10%);
background-size: 30px 30px;
background-position: 0 0, 15px 15px;
}
<div id="slow-container">
<div id="slow-container2">
</div>
<div class="slow-parent1">
<div class="slow-parent2">
<div class="slow-parent3">
stuff goes here later
</div>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: html css animation transform