When I inject a div with an SVG animated image into the HTML inside a Bootstrap 5 offcanvas, which is then displayed programmatically, the animation only starts if I open the development tools integrated with the browser.
$("#myDiv").html('<div class="" style="image-rendering: auto;"><img src="/img/loading-spinner.svg"></div>');
I’m using Chrome, version 119.0.6045.161 (Official Build) (64-bit)
2
Answers
I solved it by loading the SVG with the tag "SVG", the animation is started immediately.
I uploaded an animated SVG I made and implemented it within the code you’ve added here. The SVG animation works and can be seen in the snippet below.
I’m assuming your SVG file is the cause of the issue rather than the code you’re using here.