javascript Owl Carousel 选择当前项目?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/26989734/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 06:47:23  来源:igfitidea点击:

Owl Carousel select current item?

javascriptjqueryowl-carousel

提问by PsyGnosis

I want to select Owl Carousel 2 current item. How am I gonna do that? Please Help!

我想选择 Owl Carousel 2 当前项目。我该怎么做?请帮忙!

There is two center classed item in carousel i'have tried this

旋转木马中有两个中心分类的项目,我试过了

$.each(centerItems, function () {
    if (!$(this).hasClass('cloned')) {
        centerItem = $(this);
    }
});

but it not works correctly.

但它不能正常工作。

采纳答案by Jayson Cheng

I'm basing this answer on the demo on the Owl Carousel 2 homepage. To get the active items, do this:

我的这个答案基于Owl Carousel 2 主页上的演示。要获取活动项目,请执行以下操作:

$('.owl-carousel .owl-item.active')

where .owl-carouselis the carousel container and .owl-itemis the item class.

哪里.owl-carousel是轮播容器,.owl-item是项目类。

If this doesn't work, please post your HTML code.

如果这不起作用,请发布您的 HTML 代码。