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
Owl Carousel select current item?
提问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-carousel
is the carousel container and .owl-item
is the item class.
哪里.owl-carousel
是轮播容器,.owl-item
是项目类。
If this doesn't work, please post your HTML code.
如果这不起作用,请发布您的 HTML 代码。