这个幻灯片放映同时运行完美的图像和文字,但是当你在底部滚动时,每次你的下一张幻灯片发生变化或者它的跳跃在顶部时出现问题,不要没有原因。
这是参考链接:http://new.kingspointcap.com/home
以下是js代码:
/*----------Slideshow of text------------*/
var faderIndex = 2, //to keep track, also it will start from 1st because last value is 0
faders = $('.fadeTxt'); //cache, so we won't have to walk the dom every time
function nextFade() {
//fade out element over 3000 milliseconds, after which call a function
$(faders[faderIndex]).fadeOut(6000, function () {
//increase the index and do a check, so we won't overflow
faderIndex++;
if (faderIndex >= faders.length)
faderIndex = 0;
//fade in the next element, after which call yourself infinitely
$(faders[faderIndex]).fadeIn(3000, nextFade);
});
}
//get the ball rolling
nextFade();
/*----------Slideshow of text------------*/
答案 0 :(得分:2)
问题是,fadeOut
动画以display: none;
结尾。在此fadeOut
和下一个fadeIn
之间,文档较小,浏览器必须滚动。
设置包装器的width
和height
(div
带有id
横幅),例如:
#banner {
...
width: 100%;
height: 174px;
}
现在应该可以了。