我的网站上有一个 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)上试过这个,但我无法让它与垂直滚动一起工作。它似乎有问题。