有什么办法可以将隐藏的溢出添加到一侧吗?

时间:2019-05-10 13:39:23

标签: jquery html css carousel

我有一个滑块,其中设计的左侧在网格中,但右侧流出。有什么办法可以增加隐藏在一侧的溢出吗?像overflow-x-left:隐藏; ?

有人提到使用clip,但要注意的是,它实际上需要从网格的左侧开始,并与网格上方的内容对齐。

如果有人有任何建议,我将非常感谢您的见解。

先谢谢您。

您可以看到此处的滑块处于活动状态(向下3/4),这可能有助于WP Bakery容器元素定位,该对象应该是适合的容器: https://stable.stable-demos.com/cora/

布局示例:

enter image description here滑块,应该从网格左侧开始开始,但右侧一直到浏览器边缘。

这是当前代码:

jQuery(document).ready(function($) {
  // SWIPER FOR CAROUSEL
  var mySwiper2 = new Swiper('.swiper-container-2', {
    // Optional parameters
    init: true,
    direction: 'horizontal',
    loop: true,
    preloadImages: true,
    slidesPerView: 'auto'
  })
});
.swiper-container-2 {
  width: 100%;
}

.swiper-slide {
  width: auto;
  margin: 0 15px;
}

.swiper-slide img {
  max-height: 340px;
}

.swiper-container-2:hover {
  cursor: url(https://stable.stable-demos.com/wp-content/uploads/curse-custom-v2.png), auto;
}

.swiper-slide div {
  text-align: center;
  font-family: 'gt_sectra_fineregular_italic';
  display: block;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/css/swiper.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/Swiper/4.5.0/js/swiper.min.js"></script>

<!-- Slider main container -->
<div class="swiper-container-2">

  <!-- Additional required wrapper -->
  <div class="swiper-wrapper">

    <!-- Slides -->
    <div class="swiper-slide">

      <img src="https://stable.stable-demos.com/wp-content/uploads/slide-1.jpg" />
      <div>This is about this image</div>
    </div>
    <div class="swiper-slide">

      <img src="https://stable.stable-demos.com/wp-content/uploads/slide-2.jpg" />
      <div>Some information about this one too</div>
    </div>
    <div class="swiper-slide">

      <img src="https://stable.stable-demos.com/wp-content/uploads/slide-1.jpg" />
      <div>Wow this is amazing stuff</div>
    </div>
  </div>
</div>

0 个答案:

没有答案