1

I have this piece of code that gets called every time my slideshow is switching images. It is supposed to make the opacity of the current image 0, then switch to another image after 250ms.

The current code works perfectly in every browser I've tested except for the latest ios safari version (not sure about desktop safari). The problem that I get in safari is that the 250ms delay only works for the first image switch then stops working for any later image switches. The result is that the images switch without the 250ms delay in between.

Am I doing something I shouldn't be or is this just the behaviour of safari. If so, how should I fix it?

this.setState(prevState => ({imageOpacity: 0}), () => {

    setTimeout(()=> {this.setState(prevState => ({imageIndex: newImageIndex, imageOpacity: 1}))}, 250);
    });
Emir Sahin
  • 125
  • 6

0 Answers0