Preloading background images
-
I remember when @baris or was it @julian one of you told me I should preload the images. Using jQuery, what would be the best way to preload the images? Right now, I believe my preloading method is ineffective as I am using CSS to preload the images. Right now I will have to optimize ALL of the images in my assets folder using PNG Crush and I am extremely tempted to using Varnish Cache with Nginx. Not sure about this yet. I've used it before and it was extremely effective but I'm sure thats a case-by-case basis.
What do you guys recommend?
-
If you have an array of images, just loop through them and prepend img tags to body; set a class for them to be display: none. For better performance set preloaded to a timestamp in localStorage and skip process on subsequent loads.
Also for you specifically, I noticed that you used to do an onHover effect for category images (I think it took greyscale to color) - best if you did that via a spritesheet rather than loading a brand new image.
There might be better solutions but throwing this out there
-
When's the last time you went to the site? There are no grayscale effects any more because it taxes the browser rending all of the effects.
I use a deferred method now as this article describes.
-
I pretty much check it every day. I had figured that you were just waiting to add those images back once you're happy with the layout and such
edit: so you're not? you know the category image thing I implemented in NodeBB was inspired by you right?
edit2: woahohoah, definitely what you have right now I did not see like 1-2 days ago. Very impressive!
-
Haha. Yeah I was sure you haven't checked it LATELY. and yes @psychobunny I'm well aware. I'm sure many people will love that enhancement.
Thanks @julian