作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试将 Slick 与我的 Bootstrap 4 网站集成,但这让我很难过。我的目标是将我的文本放在缩略图上。它以某种方式移动到缩略图下方。知道为什么吗?
HTML
<div class="row">
<div class="col-12 tb-items">
<div class="row tb__item">
<div class="col-5">
<img class="tb__thumbnail" src="{% static "img/placeholders/fb.jpg" %}">
</div>
<div class="col-7">
<a href="#">Book</a>
<h3><a href="#">1 The Everlast Notebook</a></h3>
<p>One smart, reusable notebook to last the rest of your life? That's not magic, that's the Everlast.</p>
<p>by <a href="#">Andrew Noah</a></p>
<div class="tb__votes">
<b>123123123</b><br>votes
</div>
<div class="tb__date-created">
<b>23</b><br>days ago
</div>
</div>
</div>
<div class="row tb__item">
<div class="col-5">
<img class="tb__thumbnail" src="{% static "img/placeholders/fb.jpg" %}">
</div>
<div class="col-7">
<a href="#">Book</a>
<h3><a href="#">1 The Everlast Notebook</a></h3>
<p>One smart, reusable notebook to last the rest of your life? That's not magic, that's the Everlast.</p>
<p>by <a href="#">Andrew Noah</a></p>
<div class="tb__votes">
<b>123123123</b><br>votes
</div>
<div class="tb__date-created">
<b>23</b><br>days ago
</div>
</div>
</div>
</div>
</div>
CSS
.tb__thumbnail {
width: 100%;
}
JavaScript
$(function () {
$('.tb-items').slick({
arrows: false,
})
$('.tb__topic').click(function () {
$('.tb-items').slick('slickNext')
}
)
})
最佳答案
我会在 ul
中创建您的列,每个 .tb__item
作为 li
。让我知道您的情况如何?
$(function () {
$('.tb-items').slick({
arrows: false,
})
$('.tb__topic').click(function () {
$('.tb-items').slick('slickNext')
}
)
})
.tb__thumbnail {
width: 100%;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.8.1/slick.css" rel="stylesheet"/>
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.css" rel="stylesheet"/>
<div class="row">
<div class="col-12 tb-items">
<ul class="tb-items">
<li class="tb__item">
<div class="row">
<div class="col-5">
<img class="tb__thumbnail" src="https://images.unsplash.com/photo-1488393660112-976f752342de?dpr=1&auto=format&fit=crop&w=568&h=539&q=60&cs=tinysrgb">
</div>
<div class="col-7">
<a href="#">Book</a>
<h3><a href="#">1 The Everlast Notebook</a></h3>
<p>One smart, reusable notebook to last the rest of your life? That's not magic, that's the Everlast.</p>
<p>by <a href="#">Andrew Noah</a></p>
<div class="tb__votes">
<b>123123123</b><br>votes
</div>
<div class="tb__date-created">
<b>23</b><br>days ago
</div>
</div>
</div>
</li>
<li class="tb__item">
<div class="row">
<div class="col-5">
<img class="tb__thumbnail" src="https://images.unsplash.com/photo-1488393660112-976f752342de?dpr=1&auto=format&fit=crop&w=568&h=539&q=60&cs=tinysrgb">
</div>
<div class="col-7">
<a href="#">Book</a>
<h3><a href="#">1 The Everlast Notebook</a></h3>
<p>One smart, reusable notebook to last the rest of your life? That's not magic, that's the Everlast.</p>
<p>by <a href="#">Andrew Noah</a></p>
<div class="tb__votes">
<b>123123123</b><br>votes
</div>
<div class="tb__date-created">
<b>23</b><br>days ago
</div>
</div>
</div>
</li>
</ul>
</div>
</div>
关于javascript - 为什么我的文本不在 Bootstrap 4 和 Slick 中的缩略图旁边?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48000191/
我有一个具有可变数量子元素的固定大小的 div。我不知道 children 的大小。目标是缩小它们以适合父级。 例子: .parent { width: 100px; height: 100p
我是一名优秀的程序员,十分优秀!