Will an image load if it has its CSS set so that visibility is hidden?
Asked
Active
Viewed 6,116 times
4 Answers
16
Yes, it will still be loaded and held within the DOM. Then you can show it quickly with JS!

adam
- 22,404
- 20
- 87
- 119
2
Yes - I have used this to preload images that will be shown with Javascript.
You can verify this experimentally:
visibility: hidden

Nathan Long
- 122,748
- 97
- 336
- 451
-
1Err. Why don't you simply setup a little html document with a non-existent image and then watch the server's log? – innaM Feb 23 '09 at 17:01
-
2becasue you may not have your own server. Firebug however can also thell you this in the NET panel. – Pim Jager Feb 24 '09 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. – Matti Virkkunen Jan 10 '13 at 09: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. – Nathan Long Jan 10 '13 at 13:44
1
This depends entirely upon the browser and its environment (e.g., low memory situations such as mobile phones).

Jeremy L
- 7,686
- 4
- 29
- 36