这是我的web page美元.
获取问题后,当AJAX请求进行时,将对update按钮应用css类‘updating’.
该类有两个伪元素.(:之前n:之后)
但仅当添加类时:之前出现而不是:after (它也有内容属性)
.update-question-form button {
display: inline-block;
background-color: #007bff;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 3px;
cursor: pointer;
font-size: 16px;
position: relative;
overflow: hidden;
z-index: 1;
}
/* Add animation to the update button */
.update-question-form button.updating:before,
.update-question-form button.updating::after {
position: absolute;
width: 33%;
height: 200%;
transform: translateX(-50%) translateY(-50%) rotate(-20deg);
animation: slide1 1s linear infinite;
z-index: -1;
}
.update-question-form button.updating::after {
content: " ";
background-color: #ccc;
animation: slide2 1s linear infinite;
}
.update-question-form button.updating:before {
content: '';
background-color: #09316c;
animation: slide1 1s linear infinite;
}
@keyframes slide1 {
0% {
right: -33%;
}
100% {
right: 100%;
}
}
@keyframes slide2 {
0% {
right: -100%;
}
100% {
right: 33%;
}
}