Animation 动画部分暂停,无法在边缘上工作
我目前在Edge上测试网站的兼容性时遇到问题。 事实上,我有一个CSS动画,允许宇航员在页面中移动和旋转。 当鼠标在宇航员身上时,它应该停止运行并显示“你好”。 它可以在Chrome、Mozilla上运行,但在Edge上它会停止移动,但不会旋转。 我在微软官方网站上找不到任何帮助。 提前感谢您的帮助 以下是我的CSS:Animation 动画部分暂停,无法在边缘上工作,animation,microsoft-edge,Animation,Microsoft Edge,我目前在Edge上测试网站的兼容性时遇到问题。 事实上,我有一个CSS动画,允许宇航员在页面中移动和旋转。 当鼠标在宇航员身上时,它应该停止运行并显示“你好”。 它可以在Chrome、Mozilla上运行,但在Edge上它会停止移动,但不会旋转。 我在微软官方网站上找不到任何帮助。 提前感谢您的帮助 以下是我的CSS: /* 6. Animation cosmonaute */ #cosmonaute { background-image: url('Sources/img/cosmon
/* 6. Animation cosmonaute */
#cosmonaute {
background-image: url('Sources/img/cosmonaute.png');
width: 81.9px;
height: 89px;
cursor: pointer;
z-index: 99999;
position: absolute;
bottom: 0;
left:-10%;
-webkit-animation-name: animCosmonaute;
animation-name: animCosmonaute;
-webkit-animation-duration: 15s;
animation-duration: 15s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
-webkit-animation-timing-function: linear;
animation-timing-function: linear;
}
@-webkit-keyframes animCosmonaute {
0% {bottom:0; left:0;}
25%{bottom:15em; left:15em;}
50%{bottom:30em; left:30em;}
75%{bottom:45em; left:45em;}
100%{-webkit-transform: rotate(360deg) scale(1.5,1.5);transform: rotate(360deg) scale(1.5,1.5);bottom:60em; left:55em;}
}
@keyframes animCosmonaute {
0% {bottom:0; left:0;}
25%{bottom:15em; left:15em;}
50%{bottom:30em; left:30em;}
75%{bottom:45em; left:45em;}
100%{-webkit-transform: rotate(360deg) scale(1.5,1.5);transform: rotate(360deg) scale(1.5,1.5);bottom:60em; left:55em;}
}
#cosmonaute p {
position: absolute;
top: -20%;
right: 0;
display: none;
}
下面是我的JS代码:
// 2. Animation cosmonaute
var play = 1;
$('#cosmonaute').hover(function () {
$('#cosmonaute').css('animation-play-state', 'paused');
if (play === 1) {
$('#cosmonaute').css('animation-play-state', 'paused');
$('#cosmonaute').children(':first').css('display', 'block');
play = 0;
} else {
$('#cosmonaute').css('animation-play-state', 'running');
$('#cosmonaute').children(':first').css('display', 'none');
play = 1;
}
});
为什么你想通过JS而不是CSS来解决这个问题?我并不特别想使用JS,我只是想找到解决方案。如果CSS中有,请告诉我。为什么你想通过JS而不是CSS来解决这个问题?我并不特别想使用JS,我只是想找到解决方案。如果CSS中有一个,请让我知道。