我一直在研究图片库自动化,但我的 AnimationEnd EventListener 无法正常工作。我有这个在另一个文件和在线工作,所以我有点困惑。我唯一的想法是使用 ClassNames 把事情搞砸了。
有人对我如何解决这个问题有一些想法吗?我已经尝试了我能想到的一切。
<script>
var count = 0;
function slide_show() {
var so = document.getElementById("s0");
var slides = document.getElementsByClassName("s"),
i = slides.length;
if (count < i) {
slides[count].style.animation = "slideshow cubic-bezier(0.9,0.9,0.9,0.9) 2s 1 ",
slides[count].style.webkitAnimation = "slideshow cubic-bezier(0.9,0.9,0.9,0.9) 2s 1 ",
slides[count].style.position = "fixed",
count++;
setTimeout(slide_show, 1600);
so.style.visibility = "hidden",
so.style.position = "absolute";
} else if (so.style.visibility == "hidden" && so.style.position == "absolute") {
so.style.visibility = "visible",
so.style.position = "static";
slides[count].addEventListener('webkitAnimationEnd', function (slideshow) {
this.style.webkitAnimationName = "none";
slides[count];
}, false),
slides[count].addEventListener("animationend", function (slideshow) {
this.style.animationName = "none";
slides[count];
}, false);
slides[count].addEventListener("MSAnimationEnd", function (slideshow) {
this.style.MSAnimationName = "none";
slides[count];
}, false);
slides[count].addEventListener("oAnimationEnd", function (slideshow) {
this.style.oAnimationName = "none";
slides[count];
}, false);
}
}
function cssAnimationEnd() {
slides[count].addEventListener('webkitAnimationEnd', function (slideshow) {
this.style.webkitAnimationName = "none";
slides[count];
}, false),
slides[count].addEventListener("animationend", function (slideshow) {
this.style.animationName = "none";
slides[count];
}, false);
slides[count].addEventListener("MSAnimationEnd", function (slideshow) {
this.style.MSAnimationName = "none";
slides[count];
}, false);
slides[count].addEventListener("oAnimationEnd", function (slideshow) {
this.style.oAnimationName = "none";
slides[count];
}, false);
}
</script>