I am building a site that is using a scrolling plugin that basically animates the scrolling. I am quite concern about performance as if I insert some images in the site, it looks quite choppy when scrolling/animating.
The main problem I can detect with images is the reflow/repaint issue, when the image doesn't have the correct dimensions and therefore is scaled (I have to deal with this, I know about the best practice).
With this statement in mind (images will be scaled). What should be better, image element or divs with those images as backgrounds as for performance?
I made this jsFiddles that in my chrome browser memory tool, show that the back-ground image option uses less memory.
<img />
: http://jsfiddle.net/ek6Xn/
<img src="..." />
background-image
: http://jsfiddle.net/ek6Xn/1/
<div></div>
div {
background:url(...);
background-size:100% 100%;
}
References: