Answer the question
In order to leave comments, you need to log in
How can you control GIF animation in Google Chrome?
Here: www.the-village.ru/village/situation/situation/171... (or on any other article on The Village) from time to time a banner "Concept of the week - a gadget apartment" appears.
The content of the element is a link and a gif image, no tricks. At the same time, the banner behaves in Google Chrome as follows: it shows different frames of the gif statically depending on the scroll position; when approaching the top or bottom of the page, it starts the animation from the last static frame.
In Firefox, Safari - does not work, there the gif is simply animated.
How can such behavior be implemented? The internet offers solutions with canvas, but it doesn't exist here .
Answer the question
In order to leave comments, you need to log in
Apparently, this is a bug related to position: fixed. If you change the position to any other, then the animation works again. Fixed elements are drawn separately, and apparently chrome forgets to draw every frame, or tries to save resources.
When approaching the top and bottom borders, the script changes the style of this element, so the animation will be rendered normally.
But there is no catch, they just track the scroll and change the picture periodically
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question