Keeping layers from shifting on a centered layout?

liunx

Guest
7534.1 <br />
<br />
Hi folks, <br />
<br />
I have a page with a centered table on it. Within that table I'm using a nice scrolling layer app. My problem is that when the window is resized smaller or starts off in a non-maximized state, the layer shifts on the page. This doesn't happen when I left justify the entire table but I want it centered instead of flush left.<br />
<br />
I'm putting an example here: <!-- w --><a class="postlink" href="http://www.starfieldmedia.com/polkadot">www.starfieldmedia.com/polkadot</a><!-- w --> for those of you who want to see what I mean. I'm sure the fix is something rediculously simple but I've been at it for 2 days on and off now and haven't been making any headway.<br />
<br />
Thanks!<br />
<br />
Craig<!--content-->window.onresize = reCenter;<br />
<br />
function reCenter(){<br />
var w = (window.innerWidth) ? window.innerWidth : document.body.clientWidth;<br />
var h = (window.innerHeight) ? window.innerHeight : document.body.clientHeight;<br />
var lw = 100; // width of layer<br />
var lh = 100; // height of layer<br />
<br />
var layerObj = (document.all) ? document.all['layerName'] : (document.getElementById) ? document.getElementById('layerName') : document.layers['LayerName'];<br />
<br />
var styleObj = false;<br />
<br />
if (document.layers){<br />
styleObj = layerObj;<br />
} else { <br />
styleObj = eval(layerObj+".style");<br />
}<br />
<br />
if (styleObj){<br />
styleObj.top = parseInt(h/2 - (lh/2));<br />
styleObj.left = parseInt(w/2 - (lw/2));<br />
}<br />
<br />
}<!--content-->
 
Back
Top