【问题标题】:Showing multiple images with Owl carousel outside container使用 Owl carousel 在容器外显示多个图像
【发布时间】:2016-05-08 19:48:23
【问题描述】:

我正在使用 Owl Carousel 插件在行容器中显示 4 个缩略图(使用 Bootstrap)。如何在不更改容器内的 4 个缩略图的情况下在容器外显示更多缩略图?我在几个网站上看到过这种效果,遗憾的是我不记得确切的位置了。

容器外的图像就像在阴影中一样,直到它们进入内部并变得可见。在图像中,蓝色缩略图是常规图像,外部的不透明度降低或具有背景颜色作为叠加层。

  $('.owl-carousel').owlCarousel({
    loop:true,
    margin:10,
    nav: true,
    navText: ['<i class="fa fa-angle-left" aria-hidden="true"></i>','<i class="fa fa-angle-right" aria-hidden="true"></i>'],
    dots: false,
    autoplay: true,
    autoplayTimeout: 3200,
    autoplaySpeed: 2000,
    responsive:{
      0:{
        items:1
      },
      600:{
        items:4
      }
    }
  })


<div class="container">
      <ul class="owl-carousel">
        <li>
          <figure>
            <img src="http://placehold.it/350x150" alt="" />
          </figure>
        </li>
      </ul>
</div>

http://codepen.io/anon/pen/MyLOrq

【问题讨论】:

    标签: javascript jquery css twitter-bootstrap owl-carousel


    【解决方案1】:

    将此添加到您的样式中:

    .owl-carousel .owl-stage-outer {
        overflow: visible;
    }
    .owl-carousel .owl-stage-outer .owl-item {
        opacity: 0.25;
        transition: opacity 0.5s ease-out;
    }
    .owl-carousel .owl-stage-outer .owl-item.active {
        opacity: 1;
    }
    

    玩你喜欢的价值观。

    【讨论】:

    • 哇,就这么简单?我不敢问,认为它太复杂了
    • 我从多次用头敲桌子学到的一件事是尝试在任何地方都想得更简单——简单更好。尝试先考虑 CSS,然后再考虑 JavaScript。
    猜你喜欢
    • 1970-01-01
    • 2021-08-09
    • 2021-02-01
    • 2021-12-05
    • 2021-08-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-10
    相关资源
    最近更新 更多