光滑的滑块下一个箭头不显示 [英] Slick Slider Next Arrows not showing
问题描述
我正试图使下一个和上一个箭头显示在产品滑块旁边,就像在Slick Slider示例中一样.但是我的示例似乎没有加载适当的字体来实现这一目标.
I'm trying to get the next and previous arrows to show up next to the product slider, just like in the Slick Slider example. But my sample doesn't seem to load the appropriate fonts to make that happen.
这是我的代码:
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
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/
推荐答案
在您的小提琴中,您忘记将slick-theme.css文件添加为外部资源.如果要遵循作者的默认样式,则需要该文件.或者,如果您想要自己的样式,请继续进行自己的样式设置,并使其成为自己的主题.css文件或其他内容.
In your fiddle, you had forgotten to add the slick-theme.css file as an external resource. If you wanted to follow the default styling of the author, you need that file. Or if you want your own styling then please go ahead and make your own styling and make it youw own theme .css file or something.
<link rel="stylesheet" type="text/css" href="http://kenwheeler.github.io/slick/slick/slick-theme.css"/>
和此css以获得可见性,
and this css for visibility,
.slick-prev:before, .slick-next:before{
color:red;
}
此处的代码段...
$(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>
希望这会有所帮助
这篇关于光滑的滑块下一个箭头不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!