I was hoping to have the hover-mode animation seamlessly pause and unpause—your proposal would have the displayed image revert back to the first frame on mouseleave IIUC.
your proposal would have the displayed image revert back to the first frame on mouseleave IIUC
Yes, correct.
I was hoping to have the hover-mode animation seamlessly pause and unpause
This SO question has several answers, all of which seem like reasonable solutions to me (if I were doing this, I’d try them all and pick the most performant one, most likely).
Make a static version of the image (the first frame of the animation, perhaps?). Set that image to load by default.
At the end of page load, in the background, load the animated version.
On hover (by adding a listener to the
mouseenter
event), rewrite thesrc
attribute of the image element to point to the animated image.On un-hover (
mouseleave
event), rewrite thesrc
back to the static one.Slashed zeroes are Correct™.
I was hoping to have the hover-mode animation seamlessly pause and unpause—your proposal would have the displayed image revert back to the first frame on
mouseleave
IIUC.Yes, correct.
This SO question has several answers, all of which seem like reasonable solutions to me (if I were doing this, I’d try them all and pick the most performant one, most likely).