wordpress - CSS3 反弹关键帧不起作用

标签 wordpress css animation bounce

我目前正在尝试为向下箭头创建弹跳动画。但是,无论我如何更改值,我都可以使动画正常工作,但无法识别关键帧。箭头是 Font Awesome fa-chevron-down。我的网站是用 wordpress 构建的。

我的 CSS 代码是:

.view-more > i{
    font-size: 39px;
    position: absolute;
    bottom: 2%;
    animation: bounce 2s infinite;
    -webkit-animation: bounce 2s infinite;
    -moz-animation: bounce 2s infinite;
}
@keyframes bounce{
    0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
    40% {
    transform: translateY(-10px);
  }
    60% {
    transform: translateY(-3px);
  }
}
@-webkit-keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
    -webkit-transform: translateY(0);
  }
    40% {
    -webkit-transform: translateY(-10px);
  }
    60% {
    -webkit-transform: translateY(-3px);
  }
}
@-moz-keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
    -moz-transform: translateY(0);
  }
    40% {
    -moz-transform: translateY(-10px);
  }
    60% {
    -moz-transform: translateY(-3px);
  }
}

我是不是做错了什么,因为我在谷歌上搜索过,我发现这应该有效。

我也尝试过 jsfiddle 并且关键帧正在运行。所以我真的很困惑。 https://jsfiddle.net/yewtree/qh3v7fdk/

任何帮助将不胜感激。感谢您花时间阅读我的问题。

最佳答案

您的代码对我有用。但是,我更改了 animation 属性的顺序以首先包含供应商前缀(这是首选):

.view-more > i {
  font-size: 39px;
  position: absolute;
  bottom: 2%;
  -webkit-animation: bounce 2s infinite;
     -moz-animation: bounce 2s infinite;
          animation: bounce 2s infinite;
}
@keyframes bounce{
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-3px);
  }
}
@-webkit-keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    -webkit-transform: translateY(0);
  }
  40% {
    -webkit-transform: translateY(-10px);
  }
  60% {
    -webkit-transform: translateY(-3px);
  }
}
@-moz-keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    -moz-transform: translateY(0);
  }
  40% {
    -moz-transform: translateY(-10px);
  }
  60% {
    -moz-transform: translateY(-3px);
  }
}
<html>
<head>
  <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
</head>

<body>  
  <div class="view-more">
    <i class="fa fa-chevron-down"></i>
  </div>
</body>
</html>

关于wordpress - CSS3 反弹关键帧不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31540747/

相关文章:

javascript - 标题固定有边框 - 边框只能通过滚动显示

jquery - bootstrap-combined.min.css - 两个选项卡(在不同的选项卡控件中)如何分别具有 class=active 和不同的背景颜色?

wordpress - 如何在 woocommerce 中的新订单电子邮件中显示高级自定义字段数据

PHP 警告 : session_start(): Cannot start session when headers already sent

php - 带有我模板的页眉/侧边栏/页脚的 Wordpress 空白页

html - 在视频元素上使用悬停

animation - react 动画: doubled element on state change

ios - 在 Swift 中动画字符串淡入/淡出

javascript - move.js 可以与 Sencha Touch 一起使用吗?

mysql - SQL : Update column (username) with content from another column in same table (email address)