gpt4 book ai didi

jquery - Slick Slider Next Arrows 不显示

转载 作者:技术小花猫 更新时间:2023-10-29 12:47:37 26 4
gpt4 key购买 nike

我正在尝试让下一个和上一个箭头显示在产品 slider 旁边,就像在 Slick Slider 示例中一样。但我的示例似乎没有加载适当的字体来实现这一点。

这是我的代码:

HTML

  <div class="slider">
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/8013LN_Cat.jpg" height="100" width="100">
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/HiddenTailor.9074B.jpg" height="100" width="100">
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/1600ETY.JPG" height="100" width="100">
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/VIPERPRO81.jpg" height="100" width="100">
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/garment_bag.jpg" height="100" width="100">
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/1077.jpg" height="100" width="100">
</div>
</div>

CSS

  body{
background-color: #fff;
}
.slider{
margin: 60px auto;
width: 500px;
}
div{
height: 100%;
}
p{
text-align: center;
font-size: 12px;
color: white;
}

JavaScript

$(document).ready(function(){
$('.slider').slick({
centerMode: true,
centerPadding: '60px',
dots: false,
infinite: true,
speed: 300,
slidesToShow: 4,
slidesToScroll: 1,
arrows: true
});
});

演示: http://jsfiddle.net/schwany23/j39j568c/

最佳答案

在您的 fiddle 中,您忘记将 slick-theme.css 文件添加为外部资源。如果您想遵循作者的默认样式,则需要该文件。或者,如果您想要自己的样式,请继续制作您自己的样式,并将其制作成您自己的主题 .css 文件或其他文件。

<link rel="stylesheet" type="text/css" href="http://kenwheeler.github.io/slick/slick/slick-theme.css"/>

和这个用于可见性的 css,

.slick-prev:before, .slick-next:before{
color:red;
}

The updted jsFiddle can be found here .

代码片段在这里...

$(document).ready(function() {
$('.slider').slick({
centerMode: true,
centerPadding: '60px',
dots: true,
/* Just changed this to get the bottom dots navigation */
infinite: true,
speed: 300,
slidesToShow: 4,
slidesToScroll: 1,
arrows: true
});
});
body {
background-color: #fff;
}
.slider {
margin: 60px auto;
width: 500px;
}
div {
height: 100%;
}
p {
text-align: center;
font-size: 12px;
color: white;
}
/* added the following to give the background color of the arrows as red for visibility, the default which can be found in the slick-theme.css was white */
.slick-prev:before,
.slick-next:before {
color: red;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script><script src="http://kenwheeler.github.io/slick/slick/slick.js"></script>
<link href="http://kenwheeler.github.io/slick/slick/slick.css" rel="stylesheet"/>
<link href="http://kenwheeler.github.io/slick/slick/slick-theme.css" rel="stylesheet"/>

<div class="slider">
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/8013LN_Cat.jpg" height="100" width="100" />
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/HiddenTailor.9074B.jpg" height="100" width="100" />
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/1600ETY.JPG" height="100" width="100" />
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/VIPERPRO81.jpg" height="100" width="100" />
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/garment_bag.jpg" height="100" width="100" />
</div>
<div>
<img src="http://www.onguardapparel.com/images/products/thumb/1077.jpg" height="100" width="100" />
</div>
</div>

希望对你有帮助

关于jquery - Slick Slider Next Arrows 不显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28998536/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com