我有以下脚本,在我的网站danmccready.com/Aviemore上启动幻灯片放映我的问题是,幻灯片确实每3秒改变一次,但我希望它们以逐渐淡入淡出的效果改变。我毫无兴趣地更改了crossFadeDuration变量。有什么建议吗,谢谢,丹
// set the following variables
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 3000
// Duration of crossfade (seconds)
var crossFadeDuration = 1000
// Specify the image files
var Pic = new Array() // don't touch this
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'image1.jpg'
}
function runSlideShow(){
if (document.all){
document.images.SlideShow.style.filter="blendTrans(duration=2)"
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration=1000)"
document.images.SlideShow.filters.blendTrans.Apply()
}
document.images.SlideShow.src = preLoad[j].src
if (document.all){
document.images.SlideShow.filters.blendTrans.Play()
}
j = j + 1
if (j > (p-1)) j=0
t = setTimeout('runSlideShow()', slideShowSpeed)
}发布于 2012-12-07 20:37:14
你可以使用jquery插件而不是javascript的方式。然后事情就变得容易多了。我给出了一个小例子。看一看,可能会对你有帮助:http://jsfiddle.net/YueA6/
jquery方法:
fadeOut()可以在这里使用,效果很好。
https://stackoverflow.com/questions/13762517
复制相似问题