【问题标题】:Is there any way to customize the css transition?有没有办法自定义css过渡?
【发布时间】:2021-12-16 21:43:06
【问题描述】:

据我了解,如果我尝试修改具有过渡属性的元素的样式,则修改将逐步执行。那么有没有什么办法可以监听样式的变化,防止立即修改,用自定义动画代替呢?

【问题讨论】:

  • 您可以使用transition-timing-function 设置如何计算受过渡效果影响的 CSS 属性的中间值。不过,我不完全确定这是否是您要问的。

标签: javascript css vue.js


【解决方案1】:

那就是transion 如果你想用css transition改变颜色 click more details

.box {
  width: 150px;
  height: 150px;
  background: red;
  margin-top: 20px;
  margin-left: auto;
  margin-right: auto;
  -webkit-transition: background-color 2s ease-out;
  -moz-transition: background-color 2s ease-out;
  -o-transition: background-color 2s ease-out;
  transition: background-color 2s ease-out;
}

.box:hover {
  background-color: green;
  cursor: pointer;
}
<div class="box"></div>

【讨论】:

  • 虽然正确,但这并不能回答问题?
  • 你想要什么?
猜你喜欢
  • 1970-01-01
  • 2022-09-24
  • 2012-08-21
  • 2019-11-28
  • 1970-01-01
  • 1970-01-01
  • 2023-03-07
  • 2019-12-24
  • 1970-01-01
相关资源
最近更新 更多