我正在建立一个整合Flickity的网站。该轮播非常好,因为它可以从您的网站的中间开始,并占据视口的整个宽度。
但是我也可以使用bootstrap 4,并且我使用了一个容器,它将溢出隐藏的所有内容:
例如,当我将容器的最大宽度设置为1280px时,它将包裹轻滑。这样做的最佳情况是什么?
Ps。示例:
/*! Flickity v2.2.0
https://flickity.metafizzy.co
---------------------------------------------- */
.flickity-enabled {
position: relative;
}
.flickity-enabled:focus {
outline: none;
}
.flickity-viewport {
overflow: hidden;
position: relative;
height: 100%;
}
.flickity-slider {
position: absolute;
width: 100%;
height: 100%;
}
/* draggable */
.flickity-enabled.is-draggable {
-webkit-tap-highlight-color: transparent;
tap-highlight-color: transparent;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.flickity-enabled.is-draggable .flickity-viewport {
cursor: move;
cursor: -webkit-grab;
cursor: grab;
}
.flickity-enabled.is-draggable .flickity-viewport.is-pointer-down {
cursor: -webkit-grabbing;
cursor: grabbing;
}
/* ---- flickity-button ---- */
.flickity-button {
position: absolute;
background: hsla(0, 0%, 100%, 0.75);
border: none;
color: #333;
}
.flickity-button:hover {
background: white;
cursor: pointer;
}
.flickity-button:focus {
outline: none;
box-shadow: 0 0 0 5px #19F;
}
.flickity-button:active {
opacity: 0.6;
}
.flickity-button:disabled {
opacity: 0.3;
cursor: auto;
/* prevent disabled button from capturing pointer up event. #716 */
pointer-events: none;
}
.flickity-button-icon {
fill: currentColor;
}
/* ---- previous/next buttons ---- */
.flickity-prev-next-button {
top: 50%;
width: 44px;
height: 44px;
border-radius: 50%;
/* vertically center */
transform: translateY(-50%);
}
.flickity-prev-next-button.previous {
top: 0;
right: 60px;
}
.flickity-prev-next-button.next {
top: 0;
right: 0;
}
/* right to left */
.flickity-rtl .flickity-prev-next-button.previous {
left: auto;
right: 10px;
}
.flickity-rtl .flickity-prev-next-button.next {
right: auto;
left: 10px;
}
.flickity-prev-next-button .flickity-button-icon {
position: absolute;
left: 20%;
top: 20%;
width: 60%;
height: 60%;
}
/* ---- page dots ---- */
.flickity-page-dots {
display: none;
}
.gallery-cell {
padding-right: 40px;
.card {
padding: 32px;
width: 360px;
height: 292px;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js"></script>
<div class="gallery js-flickity">
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
<div class"card gallery-cell">
<div class="card-header">
<img src="https://via.placeholder.com/400x200" width="400" height="200" alt="check" />
</div>
<div class="card-body">
Dit is een test
</div>
</div>
</div>
如果您还有其他类似的情况,请告诉我。