html - Bootstrap 轮播 - 显示所有幻灯片

标签 html css carousel slideshow bootstrap-carousel

有没有办法像这样显示所有幻灯片:

enter image description here

可能是这张事件幻灯片的左侧和右侧?

最佳答案

我以前做的就是使用这个脚本。

<script>
var slideIndex = 1;
showDivs(slideIndex);

function plusDivs(n) {
  showDivs(slideIndex += n);
}

function showDivs(n) {
  var i;
  var x = document.getElementsByClassName("mySlides");
  if (n > x.length) {slideIndex = 1}
  if (n < 1) {slideIndex = x.length}
  for (i = 0; i < x.length; i++) {
     x[i].style.display = "none";
  }
  x[slideIndex-1].style.display = "block";
}
</script>

那么图片可以这样排列:

<div class="YOUR PICTURE CLASS" style="max-width:800px;position:relative">
  <img class="mySlides" src="img_fjords.jpg" style="width:100%">
  <img class="mySlides" src="img_lights.jpg" style="width:100%">
  <img class="mySlides" src="img_mountains.jpg" style="width:100%">
  <img class="mySlides" src="img_forest.jpg" style="width:100%">

  <a class="w3-btn-floating" style="position:absolute;top:45%;left:0" onclick="plusDivs(-1)">❮</a>
  <a class="w3-btn-floating" style="position:absolute;top:45%;right:0" onclick="plusDivs(1)">❯</a>
</div>

您可以在此页面中了解更多详细信息: http://www.w3schools.com/w3css/w3css_slideshow.asp

关于html - Bootstrap 轮播 - 显示所有幻灯片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40034499/

相关文章:

javascript - 不要直接在触摸时显示悬停

android - Coverflow Carousel 效果与 Android 中的 iPhone/iPad 相同

html - 引导轮播 : open the clicked image

javascript - 三个 div 并排导致问题

html - 当悬停另一个元素时显示 div 元素

javascript - 在导航菜单中添加一个向下滑动的搜索框

javascript - fullPage.js 自动循环播放幻灯片无法前进到下一部分

html - Razor View 中的垂直对齐

php - 将可变文本嵌入到 php/html 网页中

jquery - 交叉淡入淡出元素而不求助于位置 : absolute