fixed displaying photo

This commit is contained in:
Lasha Kapanadze 2025-08-18 14:31:58 +04:00
parent 7ad20993d9
commit 23ae8e1b1d

View File

@ -86,7 +86,7 @@ $(document).ready(function () {
const selectorContainer = $("#photoSelectorContainer"); // A div to hold the photo selector
selectorContainer.empty(); // Clear any previous options
// Create a dropdown or buttons to select a photo
// Create a dropdown
const selector = $('<select id="photoSelector"></select>');
photos.forEach((photo, index) => {
const option = $('<option></option>').val(photo).text(`Photo ${index + 1}`);
@ -99,9 +99,16 @@ $(document).ready(function () {
});
selectorContainer.append(selector);
selectorContainer.show(); // Make sure the selector is visible
selectorContainer.show();
// 👉 Load first photo by default
if (photos.length > 0) {
selector.val(photos[0]); // set the first option selected
loadSinglePhoto(photos[0]); // actually load it
}
}
function loadSinglePhoto(photoPath) {
const img = $("#samplePhoto");
img.attr("src", photoPath);