我正在使用光滑的旋转木马,并希望显示3张照片。我在底部的滑动窗格中显示了3张照片。如果我设置slidestoshow = 2,一切都按预期工作,但是当slidestoshow = 3等于幻灯片总数时,幻灯片显示在底部导航中显示2个空白幻灯片,即使它仅显示了顶部滑块中的3个主幻灯片 - 对于窗格。
我意识到,如果我旋转autoplay = false,那么它可以按预期工作,但是我在照片之前/之后/之后显示我想通过自动循环的照片,因此客户可以在NAV Slide中看到所有可能的选择在自动播放时。
有什么想法如何使它起作用?我已经看到这不应该这样做,但这似乎是一个有价值的用例。至少在我的情况下。我很感激!
$('.slider-for').slick({
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 4000,
arrows: true,
fade: true,
asNavFor: '.slider-nav' /* the child Nav bar */
});
$('.slider-nav').slick({ /* the Nav display with thumbnails */
slidesToShow: 3,
slidesToScroll: 1,
asNavFor: '.slider-for', /* the parent slider */
dots: false,
focusOnSelect: true,
arrows: false,
infinite: true
});
.main {
font-family:Arial;
width:500px;
display:block;
margin:0 auto;
}
.description {
background: #fff;
color: black;
font-size: 20px;
margin: 10px;
padding: 2%;
position: relative;
text-align: center;
}
.main h3 {
background: #fff;
color: black;
font-size: 20px;
line-height: 100px;
margin: 10px;
padding: 2%;
position: relative;
text-align: center;
}
<html>
<head>
<link rel="stylesheet" type="text/css" href="slick/slick.css"/>
<link rel="stylesheet" type="text/css" href="slick/slicktheme.css"/>
</head>
<body>
<header>
</header>
<main>
<section class="main" align="center">
<div class="slider slider-for">
<div>
<img src="images/Siding/ChimneyRottingHoles.jpg"alt="Chimney with Hardboard Siding Rotting with holes">
</div>
<div>
<img src="images/Siding/Chimney New Flashing.jpg"
alt="Chimney replaced with new hardboard siding, new flashing and new cedar trim boards">
</div>
<div>
<img src="images/Siding/Chimney Cedar New Paint.jpg"
alt="Chimney and cedar trim repainted with Sherwin Williams Exterior Super Paint in a Satin finish">
</div>
</div>
<div class="slider slider-nav">
<div class="description">Rotted Siding with Holes
<h3 style="background-image: url('images/Siding/Chimney Rotting Holes.jpg'); background-size: cover">
</h3>
</div>
<div class="description">New Siding & Flashing
<h3 style="background-image: url('images/Siding/Chimney New Flashing.jpg'); background-size: cover">
</h3>
</div>
<div class="description">Painted in Satin Finish
<h3 style="background-image: url('images/Siding/Chimney Cedar New Paint.jpg'); background-size: cover">
</h3>
</div>
</div>
</section>
</main>
<footer>
</footer>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="slick/slick.min.js"></script>
<script>
$('.slider-for').slick({
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 4000,
arrows: true,
fade: true,
asNavFor: '.slider-nav' /* the child Nav bar */
});
$('.slider-nav').slick({
/* the Nav display with thumbnails */ slidesToShow: 3,
slidesToScroll: 1,
asNavFor: '.slider-for', /* the parent slider */
dots: false,
focusOnSelect: true,
arrows: false,
infinite: true
});
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js">
</script>
<title>Untitled</title>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick-theme.min.css"/>
<style>
.main {
font-family:Arial;
width:500px;
display:block;
margin:0 auto;
}
.description {
background: #fff;
color: black;
font-size: 20px;
margin: 10px;
padding: 2%;
position: relative;
text-align: center;
}
.main h3 {
background: #fff;
color: black;
font-size: 20px;
line-height: 100px;
margin: 10px;
padding: 2%;
position: relative;
text-align: center;
}
body {
background-color: #dfdfdf;
}
</style>
</head>
<body>
<main>
<section class="main" align="center">
<div class="slider slider-for">
<div><img src="images/Siding/Chimney Rotting Holes.jpg" alt="Chimney with Hardboard Siding Rotting with holes"></div>
<div><img src="images/Siding/Chimney New Flashing.jpg" alt="Chimney replaced with new hardboard siding, new flashing and new cedar trim boards"></div>
<div><img src="images/Siding/Chimney Cedar New Paint.jpg" alt="Chimney and cedar trim repainted with Sherwin Williams Exterior Super Paint in a Satin finish"></div>
</div>
<div class="slider slider-nav">
<div class="description">Rotted Siding with Holes<h3 style="background-image: url('images/Siding/Chimney Rotting Holes.jpg'); background-size: cover"> </h3></div>
<div class="description">New Siding & Flashing<h3 style="background-image: url('images/Siding/Chimney New Flashing.jpg'); background-size: cover"> </h3></div>
<div class="description">Painted in Satin Finish<h3 style="background-image: url('images/Siding/Chimney Cedar New Paint.jpg'); background-size: cover"> </h3></div>
</div>
</section>
</main>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.5.9/slick.min.js"></script>
<script>
$('.slider-for').slick({
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 4000,
arrows: true,
fade: true,
asNavFor: '.slider-nav' /* the child Nav bar */
});
$('.slider-nav').slick({ /* the Nav display with thumbnails */
slidesToShow: 2,
slidesToScroll: 1,
asNavFor: '.slider-for', /* the parent slider */
dots: false,
focusOnSelect: true,
arrows: false,
infinite: true
});
</script>
</div>
</body>
</html>