简体   繁体   English

如何删除或自定义 Bootstrap 轮播中的分页按钮

[英]How to remove or customize the pagination button in Bootstrap carousel

I'd like to remove the default button (or white dot) in Bootstrap carousel.我想删除 Bootstrap 轮播中的默认按钮(或白点)。 Is it possible to customize them?是否可以自定义它们?

在此处输入图片说明

In terms of hiding, you can use CSS to make it hidden.在隐藏方面,您可以使用 CSS 将其隐藏。 For example,例如,

.carousel-indicators li { visibility: hidden; }

would make all the dots be hidden.会使所有的点都被隐藏起来。

I think the best way to write your own template and add it by template-url param.我认为最好的方法是编写自己的模板并通过 template-url 参数添加它。 Eg:例如:

 <div class="carousel-inner" ng-transclude></div> <a role="button" href class="left carousel-control" ng-click="prev()" ng-class="{ disabled: isPrevDisabled() }" ng-show="slides.length > 1"> <span aria-hidden="true" class="glyphicon glyphicon-chevron-left"></span> <span class="sr-only">previous</span> </a> <a role="button" href class="right carousel-control" ng-click="next()" ng-class="{ disabled: isNextDisabled() }" ng-show="slides.length > 1"> <span aria-hidden="true" class="glyphicon glyphicon-chevron-right"></span> <span class="sr-only">next</span> </a>

The following worked for me以下对我有用

  1. search for .carousel-indicators li in the css file bootstrap.min.css在 css 文件 bootstrap.min.css 中搜索.carousel-indicators li

  2. change the display setting for the carousel-indicators li to nonecarousel-indicators li显示设置更改为none

example:例子:

from this .carousel-indicators li{display:inline-block;}从这个.carousel-indicators li{display:inline-block;}

to this .carousel-indicators li{display:none;}到这个.carousel-indicators li{display:none;}

The dots will no longer be displayed.点将不再显示。

Just remove indicators part from carousel declaration:只需从轮播声明中删除indicators部分:

<!-- Indicators -->
<ol class="carousel-indicators">
  <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
  <li data-target="#myCarousel" data-slide-to="1"></li>
  <li data-target="#myCarousel" data-slide-to="2"></li>
  <li data-target="#myCarousel" data-slide-to="3"></li>
</ol>

1) prevent from switching 1) 防止切换

$('.carousel-indicators li').each(function(){
    $(this).carousel('pause');
});

2) remove the active class.. 2)删除活动类..

$('.carousel-indicators .active').removeClass('active')

Write below mentioned CSS code to hide prev/next indicator for bootstrap 4.5编写下面提到的 CSS 代码来隐藏引导程序 4.5 的上一个/下一个指示器

.carousel-control-next-icon, .carousel-control-prev-icon{
  display:none;
}

or或者

.carousel-control-next-icon, .carousel-control-prev-icon{
  visibility:hidden;
}

Below is the CSS code to hide indicator下面是隐藏指示器的 CSS 代码

 .carousel-indicators li
{
  display: none;
}

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

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