I am working on implementing a modal for displaying an image gallery. The initial modal showcases thumbnails, and upon clicking a thumbnail, a secondary modal should open on top with larger images displayed in a carousel. The issue I'm facing is that when I click on a thumbnail, the second modal appears but shows both thumbnails instead of the corresponding large image.
Although the code seems correct upon inspection, there seems to be a glitch preventing it from functioning as intended.
Below is the HTML structure:
<!-- kitchens modal -->
<div class="modal kitchens-modal fade" id="kitchens-modal" role="dialog">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<!-- modal header -->
.....
The relevant CSS styles are:
.thumbnail {
height: 100px;
margin: 6px;
}
.thumbnail {
margin-bottom: 6px;
}
.carousel-control.left,
.carousel-control.right {
background-image: none;
margin-top: 10%;
width: 5%;
}
Finally, here is the associated JS code:
$('.row .thumbnail').on('load', function() {
}).each(function(i) {
if(this.complete) {
var item = $('<div class="item"></div>');
var itemDiv = $(this).parents('div');
.....
Despite having made modifications based on an online modal gallery, the functionality remains flawed. Upon clicking a thumbnail in the first modal, the second modal fails to display the corresponding large image and instead exhibits all thumbnails. Any suggestions or insights would be greatly appreciated!