Restart background SVG animation

后端 未结 7 2170
广开言路
广开言路 2021-01-01 20:20

I have an SVG set as a background image of an element. The first time the element is displayed, the animation plays correctly.

On subsequent displays (e.g. if a dupl

7条回答
  •  心在旅途
    2021-01-01 20:37

    Use a random key in the url for cache busting. Though your example does not have a long animation to properly test it, I have added repeatition of loading the image to make the difference noticable.

    url + "&" + Math.random()

    No reload demo with constant URL: http://jsfiddle.net/4ZBLr/8/

    Reload demo with random URL src: http://jsfiddle.net/4ZBLr/9/

提交回复
热议问题