0

我的网站上有一个 jCarouselLite 插件。我正在从 jquery.load 函数加载 li。我在轮播中垂直循环,并有一个功能,一旦第一个项目回到顶部就会触发。

此时,我想用另一个 ajax.load 刷新数据。这是我遇到问题的地方。重新加载该数据后,轮播将停止旋转(或者更确切地说,在后台运行)。

我尝试的一个解决方案是尝试用另一个重新安装轮播:

$("#tableapp").jCarouselLite({})

线。这似乎导致两个轮播同时运行。然后是第三个,第四个,以此类推。

所以基本上我正在寻找一些方法来清除轮播,重新加载更新的数据,然后再次运行它。有任何想法吗?

    $(document).ready(function () {
            updateConsole()    //Gets new data
            scrollWindow()     //Starts carousell
    });

    function updateConsole() {
         $('#tableapp').load('AjaxPages/ApplicationMonitor.aspx #application');
     }

    function scrollwindow() {
       $("#tableapp").jCarouselLite({
            vertical: true,
            hoverPause: true,
            visible: 4,
            auto: 6000,
            speed: 500,
            scroll: 4,
            circular: true,
            afterEnd: function (a) { ScrollEnd(a); }
        });
    };

    function ScrollEnd(a) {
        $('#tbDebug').val($('#tbDebug').val() + '\nScroll Ends');

        if (**code that determines slide 1 is back on top**) {
            updateConsoles();
            scrollWindow(); //If this code is commented, the carousel stops cycling.
                            //If it isn't commented, two carousels start and things
                            //get buggy and eventually freezes.
        }
    }

我对javascript、jquery等很陌生。我也在jCarousel(不是lite)上试过这个,但我无法让它与垂直滚动一起工作。它似乎有问题。

4

1 回答 1

0

这是一个没有特别深思熟虑的建议:

当你 ScrollEnd 时,.remove 那个 div。 http://api.jquery.com/remove/ 然后重新创建它并将负载转储到其中。 在 jQuery 中创建一个 div 元素

这会欺骗它工作吗?

于 2012-03-06T21:26:55.923 回答