This commit is contained in:
Martin Quarda 2024-05-08 13:20:56 +02:00
parent 69df1f01d6
commit 98481820f9

View File

@ -86,10 +86,11 @@ class Main extends Component {
} }
if (this.state.photos.length > 3){ if (this.state.photos.length > 3){
for(let i=this.state.currentImage - 1; i<=this.state.currentImage + 1; i++){ for(let i=this.state.currentImage - 1; i<=this.state.currentImage + 1; i++){
if(i < 0){ let j = i;
i += this.state.photos.length; if(j < 0){
j += this.state.photos.length;
} }
photos_carousel.push({'source': this.state.photos[i].original}) photos_carousel.push({'source': this.state.photos[j % this.state.photos.length].original})
} }
} }