D
D
Denis Bukreev2017-08-29 15:46:32
JavaScript
Denis Bukreev, 2017-08-29 15:46:32

Image is not displayed in safari when changing src via JS - why and how to fix it?

So it goes.
There is an array of links to pictures.
This array is passed through one tag with javascript (controlled by the slider). In chrome, everything is displayed fine, but Safari crashes and re-renders the image when you scroll or resize the browser window. An unpleasant thing. What could be the ways to solve the problem? <img>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Bukreev, 2017-08-29
@denisbookreev

It turned out that when changing the src of img in Safari, the old image remains on the page.
I decided that first I hide the picture, then I change the src, and at the end I show it.

$img.css('visibility', 'hidden').attr('src', imagePath).css('visibility', 'visibile');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question