Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1416536

    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

    #1416541

    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

    #1416741

    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

    #1416753

    Hi,
    Glad to hear that you have this sorted out, if a gif was not playing on page load then I would try this or this.
    Shall we close this thread then?

    Best regards,
    Mike

    #1416770

    If I was to implement one of these solutions with Java Script, how and where would I need to do that?

    #1416779

    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

    #1416838

    Thank you, Mike. This topic can be closed.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Restart a GIF animation: Play from first frame on every page load’ is closed to new replies.