DHTML div dilemma
-
Hi All, I'm attempting to center three div layers within a tabbed view, I'm using a function that was written by a co-worker which is great but I cannot find out were to callout the "resize" within the code. Here is what I have for the function:
function centerDivs(){ widthOfDiv = '720'; //put the div width into variable centeringTheDiv = (screen.width) ? (screen.width-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer document.all["LayerOne"].left = centeringTheDiv; document.all["LayerTwo"].left = centeringTheDiv; document.all["LayerThree"].left = centeringTheDiv; }
Now! where do I plant the resize method within the code. I've tried to center these layers by surrounding with a table and centering through the "center" tag but the layers always snap back to the left. Any suggestions would be great. Thanks In Advance. Nino -
Hi All, I'm attempting to center three div layers within a tabbed view, I'm using a function that was written by a co-worker which is great but I cannot find out were to callout the "resize" within the code. Here is what I have for the function:
function centerDivs(){ widthOfDiv = '720'; //put the div width into variable centeringTheDiv = (screen.width) ? (screen.width-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer document.all["LayerOne"].left = centeringTheDiv; document.all["LayerTwo"].left = centeringTheDiv; document.all["LayerThree"].left = centeringTheDiv; }
Now! where do I plant the resize method within the code. I've tried to center these layers by surrounding with a table and centering through the "center" tag but the layers always snap back to the left. Any suggestions would be great. Thanks In Advance. Ninofunction centerDivs(){ widthOfDiv = '740'; //put the div width into variable centeringTheDiv = (screen.availWidth) ? (screen.availWidth-widthOfDiv)/2 : 0; //find out where the middle is widthwise //do this for each div layer secondlayer.style.left= centeringTheDiv + 'px'; firstlayer.style.left = centeringTheDiv + 'px'; thirdlayer.style.left = centeringTheDiv + 'px'; firstlayer.style.visibility = "visible"; } function reDo(){ window.location.reload() } window.onresize = reDo; Nino