It's a lot harder to do what "background-size: cover" does, with an <img>.

GL

On 07/11/15 14:34, Robert O'Callahan wrote:
On Sat, Nov 7, 2015 at 2:17 PM, Geoff Lankow <ge...@darktrojan.net> wrote:

I'm displaying some quite large (6+ megapixels) images using CSS
background-image, and sometimes want to swap one for another. If I just
change the CSS property, there is a noticeable flicker as the first image
is removed, then the second image is loaded and displayed. I want to avoid
this.

My current approach is to create a second element behind the first, load
the new image in it, wait for a while, then remove the first element. This
works okay but it's a total guess how long "a while" should be - 500ms
seems to be a good amount on my machine with these particular images. So
how can I detect (with privileged code if necessary) when the second image
is ready to be displayed?

Use <img> elements instead?

Rob

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to