CSS 光滑的轮播 - 隐藏控件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29544335/
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-08-30 03:09:34  来源:igfitidea点击:

slick carousel - hide controls?

cssjquery-pluginsslick.js

提问by v3nt

Are there any options to stop slick adding next & previous buttons? I can't seem to hide them via css.

是否有任何选项可以停止添加下一个和上一个按钮?我似乎无法通过 css 隐藏它们。

<button type="button" data-role="none" class="slick-prev" aria-label="previous" style="display: inline-block;">Previous</button>

回答by Edward

Add prevArrow: falseand nextArrow: falseto where you call your carousel. Ex)

添加prevArrow: falsenextArrow: false到您调用轮播的位置。前任)

$('.slider').slick({
    dots: false,
    prevArrow: false,
    nextArrow: false
});

I added dots: falsein case you wanted to remove that too.

我添加dots: false了以防你也想删除它。

回答by Zoltan Ordog

if you want to get rid of both arrows:

如果你想摆脱两个箭头:

$('.slider').slick({
   arrows: false
});

回答by atiquratik

Do you want to hide the buttons? Then try this CSS:

你想隐藏按钮吗?然后试试这个 CSS:

.slick-prev:before,
.slick-next:before {
   display:none;
}

回答by Glen Davidson

$('.slider').slick({
 arrows: false
});

回答by netgenius.co.uk

To hide the buttons using CSS only, this worked for me:

要仅使用 CSS 隐藏按钮,这对我有用:

nav.slick__arrow {
  height: 0;
  overflow: hidden;
}

I have also used:

我也用过:

nav.slick__arrow, ul.slick-dots {
  display: none!important;
}

回答by mocni_T

I had problems with hiding buttons using javascript so I try to use it with CSS

我在使用 javascript 隐藏按钮时遇到了问题,所以我尝试将它与 CSS 一起使用

.slider button{
    display: none;
}

,but this didn't work so I use

,但这不起作用,所以我使用

.slider button{
    visibility: hidden;
}

It doesn't have pointer events so you will be good to go.

它没有指针事件,所以你会很高兴。