function firstRun() {
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
}
function secondRun() {
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
}
我不想使用Jquery,因为我是javascript的初学者。 我不能在这个层次上理解大多数Jquery语法
答案 0 :(得分:7)
您可以使用animationend
个活动。
function firstRun(){
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
rightBox.addEventListener('animationend', secondRun); //once it's finished.
}
function secondRun(){
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
rightBox.removeEventListener('animationend', secondRun);
//remove the listener so this doesn't loop.
}
答案 1 :(得分:0)
您可以从第一个函数调用第二个函数:
var firstRun = function() {
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
secondRun();
}
var secondRun = function() {
rightBox.style.animation = "TextEffectMadeWithCSS 10s";
}