在AJAX请求之后再次运行jCarouselLite [英] Run jCarouselLite again, after an AJAX request

查看:129
本文介绍了在AJAX请求之后再次运行jCarouselLite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用jCarouselLite显示帖子滚动条,该滚动条可以加载特定类别的帖子.但是,我希望能够通过AJAX切换类别.

I am using jCarouselLite to show a post scroller, which loads posts from a specific category. But, I want to be able to switch the category via AJAX.

因此,我将所有内容加载到div中,然后运行:

So, I load up everything in a div, and then run:

jQuery(function($) {
$("#serviceNews").jCarouselLite({
    vertical: true,
    hoverPause:true,
    visible: 2,
    auto:2000,
    speed:1000
});

});

它起作用...直到ajax刷新#serviceNews的innerHTML.然后jCarouselLite停止工作.我已经尝试过使用livequery:

And it works... up until ajax refreshes the innerHTML of the #serviceNews. Then jCarouselLite stops working. I've tried using livequery:

jQuery(function($) {
$("#serviceNews").livequery(function(){
    $(this).jCarouselLite({
        vertical: true,
        hoverPause:true,
        visible: 2,
        auto:2000,
        speed:1000
    });
});

});

但是同样的事情发生了.我对jQuery不太熟悉,所以我可能错过了一些显而易见的东西.

But the same thing happens. I am not very familiar with jQuery, so I'm probably missing out something obvious.

您可以在此处(位于横幅下方的中间列,和滚动条下方的switchCategory按钮.

You can find the demo here (the middle column, below the banner, with the switchCategory buttons below the scroller).

推荐答案

希望您使用的是最新代码 https://github.com/kswedberg/jquery-carousel-lite

hope you are using the latest code https://github.com/kswedberg/jquery-carousel-lite

文档在此处提到您可以以

the documentation mentions here that you could end the carousel with

$('div.carousel').trigger('endCarousel')

因此,每次您需要更新轮播时,只需将endCarousel更新,然后将jCarouselLite再次绑定至div

So every time you need to update the carousel just endCarousel and then again bind the jCarouselLite to the div

这篇关于在AJAX请求之后再次运行jCarouselLite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆