I want to make a dynamic bootstrap carousel with image thumbnails at the bottom. I went through several code snippets and answers which seems to be working in their demo and experimented those codes. I just got the code in this link working but the thumbnail was too small. Here are the functions I wrote to make dynamic carousel...
//make image thumbnails
function make_image_previews ($con){
$output = '';
$count = 0;
$result = make_query($con); //returns the images in database
while($row = mysqli_fetch_array($result)){
if($count == 0){
$output .= '<li data-target="#dynamic_slide_show" data-slide-to="'.$count.'" class="active">
<img class="d-block w-100 img-fluid" src="'.$row['image'].'">
</li>';
}else{
$output .= '<li data-target="#dynamic_slide_show" data-slide-to="'.$count.'">
<img class="d-block w-100 img-fluid" src="'.$row['image'].'">
</li>';
}
$count = $count + 1;
}
return $output;
}
And here is the html output in page source
<div class="row">
<div class="col-md-12">
<div id="dynamic_slide_show" class="carousel slide light-shadow carousel-fade carousel-thumbnails" data-ride="carousel">
<div class="carousel-inner" role="listbox">
<div class="carousel-item active">
<img src="upload/protected_matrix-background-style-computer-virus-hacker-screen-wallpa-wallpaper-green-dominant-color-format-121069553.jpg" class="d-block w-100" />
</div>
<div class="carousel-item">
<img src="upload/protected_photo-1515879218367-8466d910aaa4.jpg" class="d-block w-100" />
</div>
<div class="carousel-item">
<img src="upload/protected_UC-b6b17814-ad20-4509-8102-4efa70f6ee67.jpg" class="d-block w-100" />
</div>
</div>
<a class="carousel-control-prev" href="#dynamic_slide_show" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="carousel-control-next" href="#dynamic_slide_show" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
<!--Carousel image preview-->
<ol class="carousel-indicators">
<li data-target="#dynamic_slide_show" data-slide-to="0" class="active">
<img class="d-block w-100 img-fluid" src="upload/protected_matrix-background-style-computer-virus-hacker-screen-wallpa-wallpaper-green-dominant-color-format-121069553.jpg">
</li>
<li data-target="#dynamic_slide_show" data-slide-to="1">
<img class="d-block w-100 img-fluid" src="upload/protected_photo-1515879218367-8466d910aaa4.jpg">
</li>
<li data-target="#dynamic_slide_show" data-slide-to="2">
<img class="d-block w-100 img-fluid" src="upload/protected_UC-b6b17814-ad20-4509-8102-4efa70f6ee67.jpg">
</li>
</ol>
</div>
</div>
</div>
<hr>
There was a question with the same problem but the code was different to what I have provided in the link at top. I tried the answer changing the code but I was able only to see the three underlines. How can I solve the problem of small thumbnails in my code?
EDIT
When I tried the CSS
.carousel-indicators {
position: static;
}
.carousel-indicators>li {
width: 100px
}
the thumbnail overflows onto the next row. As in following picture, horizontal line, (<hr>
tag) is on the end of the row where the carousel is present
question from:
https://stackoverflow.com/questions/65861718/dynamic-bootstrap-carousel-with-thumbnail-navigation-in-php-and-bootstrap 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…