AnimationEnd EventListener无法正常运行

时间:2013-08-11 22:45:54

标签: javascript animation image-gallery event-listener

我一直在进行图片库自动化,我的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>

0 个答案:

没有答案