javascript - CSS 动画不适用于 animate.css 跨度

标签 javascript html css angularjs animate.css

我有一个 <button>和一个 <span>在选项卡内。我想在将鼠标悬停在按钮上时添加 animate.css 类以进行跨越。我正在使用 Angular 来包含它们。

它在 chrome 中不起作用(它在 ie 中起作用):

<div>
    <button ng-mouseover="one()" ng-mouseleave="two()">Hover over me</button>
    <span ng-class="{animated : zero, bounce : zero}">Animate me</span>
</div>

<script>
    function controlTotal($scope) {

        $scope.zero = false;

        $scope.one = function () {
            $scope.zero = true;
        };

        $scope.three = function () {
            $scope.zero = false;
        };

    };
</script>

最佳答案

display:inline-block; 与跨度一起使用:

<span style="display:inline-block;" 
    ng-class="{animated : zero, bounce : zero}">Animate me</span>

Animate.css GitHub :

Historically, span elements can't be animated with CSS. In order to animate them, you'll need to give them a display property. Obviously display: block; will give you undesirable effects, so assigning display: inline-block would be a better choice, and solve the issue.

关于javascript - CSS 动画不适用于 animate.css 跨度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37730284/

相关文章:

javascript - ES6 类私有(private)成员语法

javascript - 如何检测 DOMContentLoaded 是否被触发

HTML 索引的 jQuery 问题

javascript - 我怎样才能让这个动画更流畅?

javascript - 如何仅在第一个方法完全完成后调用另一个方法

javascript - 使用 Canvas 下载图像会增加文件的大小

javascript - 具有多个样式表和 js 链接的 Google Apps 脚本

html - 移动浏览器上奇怪的 CSS '' 叠加效果''

css - 如何使链接仅在访问后改变颜色

html - 导航栏中间的图像