Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ssis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html CSS使用关键帧更改内容_Html_Css_Css Animations - Fatal编程技术网

Html CSS使用关键帧更改内容

Html CSS使用关键帧更改内容,html,css,css-animations,Html,Css,Css Animations,我想创建一个在悬停状态下旋转1s的按钮,并在动画中更改其内容。我正在使用并希望删除按钮在悬停时变成“x”按钮 理想情况下,解除覆盖时动画也会向后运行 那么如何在动画中更改伪元素的内容呢 这是我的关键帧动画: @-webkit-keyframes { 0% { content:'\f056'; -webkit-transform:rotate(0deg); } 50% { content:'\f057'; -w

我想创建一个在悬停状态下旋转1s的按钮,并在动画中更改其内容。我正在使用并希望删除按钮在悬停时变成“x”按钮

理想情况下,解除覆盖时动画也会向后运行

那么如何在动画中更改伪元素的内容呢

这是我的关键帧动画:

@-webkit-keyframes {
    0% {
        content:'\f056';
        -webkit-transform:rotate(0deg);
    }
    50% {
        content:'\f057';
        -webkit-transform:rotate(360deg);
    }
    100% {
        -webkit-transform:rotate(720deg);
    }
}
我希望这一点能对你有所帮助

CSS

JS

.outside {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: red;
    border: 10px solid blue;
    color: white;
    text-align: center;
    line-height: 30px;
    transition: all 3s ease;
    transition-property: transform;
}
.outside:hover {
    transform: rotate(1080deg);
}
$('.outside').hover(
    function()
      {
       $('.outside').html('X');
       },
    function()
      {
       $('.outside').html('D');
      }
                    );