Will an image load if it has its CSS set so that visibility is hidden?
4 Answers
Yes, it will still be loaded and held within the DOM. Then you can show it quickly with JS!
Yes - I have used this to preload images that will be shown with Javascript.
You can verify this experimentally:
visibility: hidden
-
1Err. Why don't you simply setup a little html document with a non-existent image and then watch the server's log?– innaMFeb 23, 2009 at 17:01
-
2becasue you may not have your own server. Firebug however can also thell you this in the NET panel. Feb 24, 2009 at 20:19
-
It takes about a minute to install an HTTP server on anything... there's no reason to test anything that's eventually going to be running over HTTP like this. Jan 10, 2013 at 9:22
-
1@PimJager - good point. The Net panel in Firebug or Chrome Dev tools is a better way to see this. It will also show you if the apparent speedup is because the image is cached. Jan 10, 2013 at 13:44
This depends entirely upon the browser and its environment (e.g., low memory situations such as mobile phones).