我写了这行代码来动画我网页上的图片:
var SlideShow = function (container) {
this.images = [];
this.curImage = 0;
for (i = 0; i < container.childElementCount; i++) {
this.images.push(container.children[i]);
this.images[i].style.display = "none";
}
var nextSlide = function(){
for (var i = 0; i < this.images.length; i++) {
this.images[i].style.display = "none";
}
this.images[this.curImage].style.display = "block";
this.curImage++;
if (this.curImage >= this.images.length) {
this.curImage = 0;
}
window.setTimeout(nextSlide.bind(this), 3000);
};
nextSlide.call(this);
};
SlideShow(document.getElementById("testslide"));
幻灯片放映工作,图片改变但风格很无聊。我想要它从右到左滑入或淡入或类似,任何风格除了改变之外。我如何实现这一目标?