Rad1
asked on
JavaScript to detect and adjust Screen Size
Hi,
I have the below function to adjust the screen size in Windows 7. Is there a better way of doing this with %. If yes, how do I do it?
Thank you!!!
I have the below function to adjust the screen size in Windows 7. Is there a better way of doing this with %. If yes, how do I do it?
Thank you!!!
function myWindow() {
if (screen.width == 800) {
var wdth = 800;
document.body.style.zoom = screen.width / 940;
}
else if (screen.width == 1024) {
var wdth = 1024;
document.body.style.zoom = screen.width / 1204;
}
else if (screen.width == 1152) {
var wdth = 1152;
document.body.style.zoom = screen.width / 1351;
}
else if (screen.width == 1280) {
var wdth = 1280;
document.body.style.zoom = screen.width / 1400;
}
else if (screen.width == 1440) {
var wdth = 1440;
document.body.style.zoom = screen.width / 1710;
}
if (screen.width == 1600) {
var wdth = 1600;
document.body.style.zoom = screen.width / 1600;
}
}
ASKER
Okay great!!!
On the other hand, how can I make all my ASP.NET page position:relative; ????
Thank you!
On the other hand, how can I make all my ASP.NET page position:relative; ????
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for the great info!!!
http://css-tricks.com/css-media-queries/
You could then set the CSS zoom style by using the right media selectors
Open in new window
As a sidenote, I am not sure why you really want to force users zoom ratio, but that could have a valid design choice.
Regards,
-r-