How to play a GIF on click (like 9GaG.com) with wordpress?

前端 未结 2 1316
梦毁少年i
梦毁少年i 2021-02-08 09:08

I need to implement this \"gif player\" in a wordpress site, because gif pages are up to 6mb, so performance is really crappy

I´ve read this Onclick play GIF image with

2条回答
  •  难免孤独
    2021-02-08 10:01

    If you don't want to pause, you can easily REPLAY the gif file. Just trigger on the click and reload the gif into the image tag.

    your_image= document.getElementById or however you want to grab the reference to the image. then set an event listener for the click.

    Then your_image.src= your_image.src; And the gif will run again.

提交回复
热议问题