我正在使用jCarouselLite显示一个帖子滚动条,它从特定的类别加载帖子。但是,我希望能够通过AJAX切换类别。
因此,我将所有内容加载到一个div中,然后运行:
jQuery(function($) {
$("#serviceNews").jCarouselLite({
vertical: true,
hoverPause:true,
visible: 2,
auto:2000,
speed:1000
});});
它起作用了。直到ajax刷新#serviceNews的innerHTML。然后jCarouselLite停止工作。我尝试过使用livequery:
jQuery(function($) {
$("#serviceNews").livequery(function(){
$(this).jCarouselLite({
vertical: true,
hoverPause:true,
visible: 2,
auto:2000,
speed:1000
});
});});
但同样的事情也会发生。我对jQuery不是很熟悉,所以我可能遗漏了一些显而易见的东西。
您可以找到演示here (中间一栏,横幅下方,滚动条下方有switchCategory按钮)。
发布于 2012-05-18 19:47:00
希望您使用的是最新的代码https://github.com/kswedberg/jquery-carousel-lite
文档中提到,您可以使用以下命令结束旋转木马
$('div.carousel').trigger('endCarousel')因此,每次需要更新carousel时,只需执行endCarousel,然后再次将jCarouselLite绑定到div
发布于 2013-01-26 05:52:49
来自maniac_user的解决方案正在为我工作。
尝试设置一个:
$("div.carousel").trigger("endCarousel");在您的jCarousel代码之前:
$(".auto .jCarouselLite").jCarouselLite({
speed: 14700,
btnNext: ".next",
vertical: true,
hoverPause:true,
visible: 1
});https://stackoverflow.com/questions/9424499
复制相似问题