Closed Thread Icon

Topic awaiting preservation: div-problem... Pages that link to <a href="https://ozoneasylum.com/backlink?for=7839" title="Pages that link to Topic awaiting preservation: div-problem..." rel="nofollow" >Topic awaiting preservation: div-problem...\

 
Author Thread
GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 09-14-2001 18:06

i've got some div-layer problems:

is it possible to set a layer to screen center AND have its position absolute?

maybe you can understand my problem better if you have a look at this. www.embege.f2s.com/test/index.html
(thanks to bugs for the dhtml-script! )
i want the 3 layers be centered under the 3 table cells.

any ideas?

thank you!



[This message has been edited by GRUMBLE (edited 09-14-2001).]

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 09-14-2001 18:47

Umm there is but it's not easy.

I played with this at one point for the gurusnetwork site I was working on a way to make the associates links at the bottom scroll. It was really hard since the page is centered.

The only solution I found was to get the window height and width data and then "absoultely" position the divs in the middle.

heres a link on how that is done.



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 09-14-2001 19:43

thanks a lot bitdamaged.
i also thought of getting the screen width and then set the layers' position with a mathematical equation but i gave it up soon, since i thought it wouldnt work.

i'll have a look at the gurus' sourcecode.
thanks again!

bitdamaged
Maniac (V) Mad Scientist

From: 100101010011 <-- right about here
Insane since: Mar 2000

posted posted 09-14-2001 19:58

Oh it's not in the source code.

I never ended up implementing the scrolling so I kinda gave up. It actually works like a champ in IE I just never got it to work in NN

Here's a link http://www.bitdamaged.com/gurustest2.htm



:[ Computers let you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila. ]:

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 09-15-2001 02:44

I know, ooh, ohh, pick me! I just wrote the first scripts for the Znippets.com site, right? One of the things I do is have a simple script that tells me how wide the viewable area in the browser is, and then you just use javascript to place the left at (screenWidth-divWidth)/2 and the top at (screenHeight-divHeight)/2. Worked like a charm for me, and it's not very much code at all.

// ZNIPPets.com, "Zbrowse.js", by DocOzone... basic browser variables...

function makeZbrowse() { this.id = "Zbrowse";}
makeZbrowse.prototype.width = function() {return Zflag.IE?document.body.clientWidth:window.innerWidth;}
makeZbrowse.prototype.height = function() {return Zflag.IE?document.body.clientHeight:window.innerHeight;}
makeZbrowse.prototype.scrollY = function() {return Zflag.IE?document.body.scrollTop ageYOffset;}
makeZbrowse.prototype.scrollX = function() {return Zflag.IE?document.body.scrollLeft ageXOffset;}
Zbrowse = new makeZbrowse();

-------------

In this case, using that code in the above example, the formula would be

(Zbrowse.width()-divWidth)/2
and
(Zbrowse.height()-divHeight)/2

Set it to place it here onResize and onLoad and it will always be centered.

Your pal, -doc-



[This message has been edited by DocOzone (edited 09-15-2001).]

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 09-15-2001 08:34

Just a small information - onResize event doesn't work in Opera (you'll have to use timer to check if window has been resized)...

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 09-15-2001 12:01

wow! doc, you're great! this works! thank you very much!
but it seems to have problems with NN. is there a cross-browser version?

and, if i wouldnt have window.onerror=null, why do i get an error?
something like 'object required'

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 09-17-2001 08:28

Oh! I can see, I only gave you half the script there, I'm calling for the Zflag.IE variable, and that's set in the "Zprime.js" script. That's the "object" it's looking for, heh. Pop over to the http://www.Znippets.com/ site and grab that script too, they're both teeny-tiny, so it shouldn't be a big burden for downloading!

Your pal, -doc-

DocOzone
Maniac (V) Lord Mad Scientist
Sovereign of all the lands Ozone and just beyond that little green line over there...

From: Stockholm, Sweden
Insane since: Mar 1994

posted posted 09-17-2001 08:29

Or, just paste this bit in at the start of the other script...

function makeZflag() {
this.NS = document.layers ? 1:0;
this.IE = document.all ? 1:0;
this.gecko = document.getElementById ? 1:0;
this.mac = (navigator.appVersion.indexOf("Mac") > -1) ? 1:0;
this.opera = (navigator.appName.indexOf("Opera") > -1) ? 1:0;
}
Zflag = new makeZflag();


Your pal, -doc-

GRUMBLE
Paranoid (IV) Mad Scientist

From: Omicron Persei 8
Insane since: Oct 2000

posted posted 09-17-2001 19:08

thank you very much, doc!
i already did so.

znippets.com is very good work! keep it up!

« BackwardsOnwards »

Show Forum Drop Down Menu