gpt4 book ai didi

jquery - 仅使用 CSS 制作箭头动画

转载 作者:行者123 更新时间:2023-12-01 02:00:32 28 4
gpt4 key购买 nike

如果您检查Toshiba's website ,有一个带有移动箭头的小鼠标图标。显然,他们的动画是这样的:

function iconTop() {
$(".icon_tween").animate({
opacity: 0,
marginTop: "15px"
}, 1e3, function () {
$(".icon_tween").css({
marginTop: 0,
opacity: 1
}), iconTop()
})
}

..是否可以仅使用 CSS 制作完全相同的动画?

最佳答案

您还可以使用 translate 代替 margin top,这样它会更独立于您的元素布局并且性能更高。

@-webkit-keyframes arrow-jump {
0% { opacity: 0;}
100% { opacity: 1;
-webkit-transform: translateY(10px);
-moz-transform: translateY(10px);
-o-transform: translateY(10px);
transform: translateY(10px);
}
}
#arrow {
-webkit-animation: arrow-jump 1s infinite;
-moz-animation: arrow-jump 1s infinite
-o-animation: arrow-jump 1s infinite;
animation: arrow-jump 1s infinite;
}

demo

关于jquery - 仅使用 CSS 制作箭头动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24685053/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com