Using Javascript to Measure the Current Window -


OK, so I'm trying to create a website that has a big picture background, based on the user's window size But I want to be able to load a different size picture so they (hopefully) can not see any empty space. I want to use javascript to measure the size of the current screen. Then, depending on the size of the window, I would like to load with the image that corresponds to that resolution.

However, when I see it online, I could not find a standard way to get the size of the window, any help of all browsers is very appreciable! Also, if you have another idea of ​​implementing this, let me know!

A user's window is unlikely to vary significantly in size during use. It is best to provide only one image, and then scale it by size, it can only be obtained through CSS

img # my-big-background-image {width : 100%; }

Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -