Preserved Topic: Dynamic Positioning (Page 1 of 1) |
|
---|---|
Obsessive-Compulsive (I) Inmate From: New Orleans, LA, USA |
posted 05-21-2002 18:40
I have a <DIV> tag that I would like to place 200px from the bottom of the browser window regardless of the screen resolution. I am using a CSS style sheet to position the <DIV>. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 05-21-2002 18:48
The poster has demanded we remove all his contributions, less he takes legal action. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 05-21-2002 20:28
Nope, thankfully that's not all necessary. Most browsers support the "bottom" property: |
Maniac (V) Mad Scientist From: New California |
posted 05-22-2002 04:43
I'll have to look into the bottom property some more. I wrote this cross-browser example up to help with this question: http://www.bugimus.com/gurus/center_div.html If all of this isn't necessary, that's quite cool but it usually depends on just how cross-browser your pages *needs* to be. If you're just writing for newer browsers, then by all means go for the simplest solution. |
Maniac (V) Inmate From: Brisbane, Australia |
posted 05-22-2002 05:35
Just a small question on script bugs... |
Maniac (V) Mad Scientist From: New California |
posted 05-22-2002 06:52
I honestly don't think it's worth doing the check for the page resize. I think that it would run a bit more efficiently but that depends on just how much work is involved with updating a div's position. I'm pretty sure the browser doesn't totally redraw the div when it repositions so I think repositioning it every 0.5 seconds is no big deal. |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 05-22-2002 08:52
The poster has demanded we remove all his contributions, less he takes legal action. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 05-22-2002 22:12
Really? Do you think the browser actually checks to see if its position is different every time you move it? |
Maniac (V) Mad Scientist From: Belgrade, Serbia |
posted 05-24-2002 10:54
Some time ago, I have tested these two approaches (letting timer run constantly and aborting if size didn't change) on "BrotherCake Ultimate DropDown Menu" (I had to modify that script by myself) and my conclusion was that it's best to check if size has actually changed. Although web browsers may not redraw layers if they stay on same position, a lot of JavaScript code still has to be parsed and that puts *a lot* of pressure on the CPU... |
Paranoid (IV) Mad Scientist From: Somewhere over the rainbow |
posted 05-24-2002 11:18
The poster has demanded we remove all his contributions, less he takes legal action. |
Lunatic (VI) Mad Scientist From: Massachusetts, USA |
posted 05-24-2002 22:37
Oh, I'm sure the browser doesn't constantly redraw *every* element, but I think if it came across a javascript statement that changed the position of an element, it would consider that element to have moved without actually checking if you moved it to a different place than it already was or not. That way it can just keep a boolean value for each element on the page, keeping track of whether it needs to be redrawn or not, and if you change a style property of an element it sets that boolean to true. Then it just redraws all elements for which that boolean is true. |