diff --git a/public/userarea/parts.js b/public/userarea/parts.js index 5e12a7d..2fa8ce8 100644 --- a/public/userarea/parts.js +++ b/public/userarea/parts.js @@ -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 = $(''); photos.forEach((photo, index) => { const 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);