Tagged: animated gif
Hi Enfold-Team
I have created an animated GIF, exported it to play once and placed it on my homepage. It works fine when opening the site for the first time. However, on reload or when returning to the homepage, the GIF does not play anymore and stays on the last frame. I suppose that this is due to the fact that the browser caches the GIF file. Is there a work-around for this?
I have found an article here https://www.computerhilfen.de/english/restart-a-gif-animation-let-the-browser-play-it-again-from-start.html but I’m not sure how to incorporate the solution into enfold.
Thank you very much,
Dominic
Hey dominictschupp,
Thanks for your question and the possible solution, but I have tested your page on Windows in Chrome, Firefox, & Edge and Mac in Safari, Chrome, Firefox and on my Android mobile device, and each time I go to another page and back again the GIF animation plays. I also created a test page on my test site and the animation always loads when the page loads.
So since I can’t see the error I can not test the solution.
Best regards,
Mike
Thank you, Mike. The client has since chosen to use a looping GIF animation instead of an animation that only plays once. So, indeed, the problem is solved in this particular situation. Still, it would be helpful for me and other users to know how to solve the problem with a GIF that was exported to not loop which does not play on page reload.
Best regards,
Dominic
If I was to implement one of these solutions with Java Script, how and where would I need to do that?
Hi,
Generally you would add it to a function in your child theme functions.php like this:
function custom_script() { ?>
<script>
//add script here
</script>
<?php
}
add_action('wp_footer', 'custom_script');
Best regards,
Mike
Thank you, Mike. This topic can be closed.