Chrome jQuery Image Replacement is Slow
I need a slider that changes the current image being shown. I first tried
implementing this via a src replacement:
$("#img").attr("src", new_src);
http://jsfiddle.net/DJPDQ/1
This is very choppy in Chrome (but fine in all other browsers). I could
sort-of understand it being choppy the first time the image loads, but,
this choppy behavior persists even after having loaded all the images.
Inspecting network activity, I see repeated GETs, but they are all cached.
Just to rule out this as a possibility, I rewrote an alternative
implementation that preloads all the images, and hides all but the current
image:
http://jsfiddle.net/DJPDQ/3
But this is still choppy in Chrome (and still fine in other browsers),
which makes me think it has something to do with rendering/layout.
Anyone know what Chrome is doing differently, and how I might address the
problem?
No comments:
Post a Comment