Skip to content

Commit

Permalink
fix(+page.svelte): 🐛 Fixed a bug where the thumbnails where not updat…
Browse files Browse the repository at this point in the history
…ing the main image correctly when the array was shuffled.
  • Loading branch information
arienshibani committed Jul 4, 2024
1 parent 844a41d commit 10af048
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ let photos = [
{ src: "https://ik.imagekit.io/ari/2014dublin02", alt: "Dublin 02" },
];
// Shuffle array
photos.sort(() => Math.random() - 0.5);
// Reactive variable for the current main image
let currentPhoto = writable(photos[0]);
Expand All @@ -26,7 +23,6 @@ const updateMainPhoto = (photo) => {
};
</script>


Expand All @@ -47,7 +43,7 @@ const updateMainPhoto = (photo) => {
</div>

<div class="thumbnail-strip" >
{#each photos as photo}
{#each photos as photo (photo.alt)}
<button type="button" on:click={() => updateMainPhoto(photo)}>
<img
class="thumbnail"
Expand Down

0 comments on commit 10af048

Please sign in to comment.