本文介紹了如何在 Slick 輪播項(xiàng)目之間添加空格的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我想在兩個(gè)光滑的輪播項(xiàng)目之間添加空間,但不希望有填充的空間,因?yàn)樗鼤?huì)減小我的元素大小(我不希望這樣).
I want to add space between two slick carousel items, but not want the space with padding, because it's reducing my element size(and I don't want that).
$('.single-item').slick({
initialSlide: 3,
infinite: false
});
.slick-slider {
margin:0 -15px;
}
.slick-slide {
padding:10px;
background-color:red;
text-align:center;
margin-right:15px;
margin-left:15px;
}
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet"/>
<script src="http://cdn.jsdelivr.net/jquery.slick/1.5.0/slick.min.js"></script>
<link rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<div class="container">
<div class="row">
<div class="col-sm-12" style="background-color:gray;">
<div class="slider single-item" style="background:yellow">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>
</div>
</div>
</div>
不知何故,我從兩側(cè)獲得了空間,我正在嘗試刪除它.
Somehow I am getting space from both side, I am trying to remove that.
推薦答案
是的,我找到了dis問題的解決方案.
Yup, I have found the solution for dis issue.
- 從兩側(cè)創(chuàng)建一個(gè)額外寬度的滑塊(我們可以使用它從兩側(cè)添加項(xiàng)目空間).
- 創(chuàng)建具有適當(dāng)寬度的Inner Item Content兩邊的邊距(這應(yīng)該是你的實(shí)際包裝尺寸)
- 完成
- Create one slider box with extra width from both side( Which we can use to add item space from both sides ).
- Create Inner Item Content with proper width & margin from both sides( This should be your actual wrapper size )
- Done
這篇關(guān)于如何在 Slick 輪播項(xiàng)目之間添加空格的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!