jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了jquery – Twitter Bootstrap Carousel循环项从右到左(RTL)反转大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如何改变Twitter Bootstrap Carousel循环功能以从右到左而不是从左到右循环项目,这样在希伯来语/阿拉伯语网站中它看起来是正常的?

解决方法

只需使用调用prev而不是next的类似函数覆盖循环函数
$(document).ready(function () {
    $('.carousel').each(function(){
        $(this).carousel();

        var carousel = $(this).data('bs.carousel'); // or .data('carousel') in bootstrap 2
        carousel.pause();

        // At first,reverse the order of the items in the carousel because we're moving BACkWARDs
        $(this).find('> .carousel-inner > .item:not(:first-child)').each(function() {
            $(this).prependTo(this.parentNodE);
        });

        // Override the bootstrap carousel prototype function,adding a different one won't work (it'll work only for the first slidE)
        carousel.cycle = function (E) {
            if (!E) this.paused = false
            if (this.interval) clearInterval(this.interval);
            this.options.interval
            && !this.paused
            && (this.interval = seTinterval($.proxy(this.prev,this),this.options.interval))
            return this;
        };

        carousel.cycle();
    });
});

大佬总结

以上是大佬教程为你收集整理的jquery – Twitter Bootstrap Carousel循环项从右到左(RTL)反转全部内容,希望文章能够帮你解决jquery – Twitter Bootstrap Carousel循环项从右到左(RTL)反转所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。