简体   繁体   English

jQuery owl2在没有要循环的项目时删除导航箭头

[英]jQuery owl2 remove navigation arrow when there is no item to loop

I have the following carousel 我有以下轮播

在此处输入图片说明

I want to disappear the one of the navigation arrows when there are no items on their left/right sides.In screenshot exampe above if i try to use the left arrow it's not looping, because there are no images on the left side, so the arrow should not appear. 我想在左侧/右侧没有项目时消失其中一个导航箭头。在上面的屏幕快照示例中,如果我尝试使用左侧箭头,则不会循环播放,因为左侧没有图像,因此箭头不应出现。

Here are the settings i'm currently using 这是我当前正在使用的设置

Navigation.Defaults = {
    nav: false,
    navRewind: false,
    navText: [ 'prev', 'next' ],
    navSpeed: false,
    navElement: 'div',
    navContainer: false,
    navContainerClass: 'owl2-nav',
    navClass: [ 'owl2-prev', 'owl2-next' ],
    slideBy: 3,
    dotClass: 'owl2-dot',
    dotsClass: 'owl2-dots',
    dots: true,
    dotsEach: false,
    dotData: false,
    dotsSpeed: false,
    dotsContainer: false,
    controlsClass: 'owl2-controls',
    loop: false,
};

Try with the css like below. 尝试如下所示的CSS。

.owl-nav .owl-prev.disabled,
.owl-nav .owl-next.disabled {
   display: none !important;
}

Or you can do that with js from this answer https://stackoverflow.com/a/28027976/9695286 或者您可以通过此答案中的js使用https://stackoverflow.com/a/28027976/9695286

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM