Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layers aligned relative to browser window

Status
Not open for further replies.

Jusenkyo

Programmer
Aug 16, 2002
295
0
0
GB
Hello all

I have a page made mostly of layers. I would like them to all be aligned relative to the bowser window - i.e. always centered.

At the moment I have to put the actual pixel value of the layers location.

Any ideas?
 
I have done this a few times.

Basically you have to do math calculations in JavaScript based on the browser's window size. I think the syntax is something like screen.width, screen.height. Or maybe that is for the screen size. Anyway, the syntax for the browser window is similar.

Then use JavaScript/DHTML to tell the layer(s) exactly where you wante them situated. Using CSS you have to tell the layers that they are "position:absolute" and then set the "top" and "left" using your DHTML.

Sorry I don't have any code for you, lemme know if this is good enough.
 
That all makes perfect sense.

Unfortionately I aint to good with javascript/DHTML coding, but I get the principle of it.

Do you think this is a wise way to set up a website? i.e. using Layers and Javascript to place it?



If anyone has any code lying around too - I will gratefully take it of your hands!!
 
I think it's a great way to do it. But I would say look at your web stats first. When I do this kind of site, I do it when 95% or better use Internet Explorer, cuz Netscape doesn't have great support for it, and customizing Netscape doubles the amount of code you have to write because it treats layers differently.

(Netscape uses document.layers and IE uses document.all and the HTML DIV tag)
 
Luckily I am developing this site for use on the company intranet... so 100% of our users have IE!
 
Any ideas about the code I might use then?
 
hiya DeveloperDood

Where have you used Layers on this site then?

I aint too good with coding - I do most of my design in DW MX, and just do the SQL/ASP coding myself...
I am Naff as far as HTML/Java goes!
 
I see what you've done there. Good Idea.

But I dont think the people in the office would appreciate having to click on a link to open the site...

Anymore ideas?

Or even better - can anyone suggest a better way to build the site? It has to run really fast!

 
I see you were planning on a layer... you could adapt my code to layerrs (I'd help, but not much experience with layers), you could have it open automatically. I think layers are your best bet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top