search

Home  >  Q&A  >  body text

javascript - How to solve the problem of flickering when dynamically replacing images based on time?

The seedlings in the picture have three growth states. Use the countdown method to dynamically change the src in the img tag.
It performs well on Android. On iOS, it counts once and the seedlings flash once.
I don’t know the reason. Can I ask for a solution?

js is written like this (very scumbag, don’t spray~)

仅有的幸福仅有的幸福2779 days ago607

reply all(3)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:18:06

    1. First, preload the image

    2. Just change the src attribute of the image every time to reduce unnecessary rearrangements

    reply
    0
  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:18:06

    Combine the picture into a Sprite picture and modify the display coordinates of the picture

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-19 10:18:06

    Image preloading is the key

    reply
    0
  • Cancelreply