0

此幻灯片放映同时与图像和文本完美运行,但是当您在底部滚动时出现问题,并且每次下一张幻灯片更改或出现然后它跳到顶部时,不知道为什么。

这是参考链接: 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------------*/
4

1 回答 1

2

问题是,fadeOut动画以display: none;. 在这个fadeOut和下一个之间fadeIn,文档变小了,浏览器必须滚动。

设置包装器的widthand (带有横幅的),例如:heightdivid

#banner {
    ...
    width: 100%;
    height: 174px;
}

现在它应该可以工作了。

于 2012-06-29T06:57:44.100 回答