NameSilo

Javascript code for resolution (you need to edit it)

Spaceship
Watch

axilant

Account Closed
Impact
28
This is how im using it, im using 2 div's with the ids of header and content.

Just showing you this code, because many people ask for this type of thing so here it is :)

Code:
<script language="Javascript"><!--
var header = document.getElementById("header");
var content = document.getElementById("content");
if ((screen.width == 800) && (screen.height == 600)) {
var leftsize = "40";
header.style.left = leftsize;
content.style.left = leftsize;
}
if ((screen.width == 1024) && (screen.height == 768)) {
var leftsize = "150";
header.style.left = leftsize;
content.style.left = leftsize;
}
if ((screen.width == 1152) && (screen.height == 864)) {
var leftsize = "200";
header.style.left = leftsize;
content.style.left = leftsize;
}
if ((screen.width == 1280) && (screen.height == 1024)) {
var leftsize = "275";
header.style.left = leftsize;
content.style.left = leftsize;
}
if ((screen.width == 1600) && (screen.height == 1200)) {
var leftsize = "450";
header.style.left = leftsize;
content.style.left = leftsize;
}


//--></script>

PM me any questions, or just post here ;)
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
This script works only with certain fixed resolutions. For example, in my work I have 1024x1280 (yes, it's 1280x1024 rotated 90 degrees - VERY useful for viewing long pages and documents!). Your script will not know what to do with this resolution. You should make it more general.
 
0
•••
Michau said:
This script works only with certain fixed resolutions. For example, in my work I have 1024x1280 (yes, it's 1280x1024 rotated 90 degrees - VERY useful for viewing long pages and documents!). Your script will not know what to do with this resolution. You should make it more general.


Thats why it says, you will need to edit it.
 
0
•••
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back