Re: Absolute positioning - a done deal?

"Jonathan Berry" <[email protected]> Mon, 24 Apr 2006 23:38:19 -0700
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Thanks for the replies, group. This was really a couple of problems with
some ads we are running.

I discovered the solution to one ad problem though. There turns out to be
two. The first ad we had problems with was the result of the ad loading
after the page alignment was done, so I used a setTimeout to run the
restoreAlign function there. I also have found the following code to work to
some degree with the second ad, but need help with my style attributes. This
ad is pulling in parent elements some with absolute positioning and some
with align="right". This is done from memory since I am not a my desk any
longer, so please bear with me if I have made a mistake:

function restoreAlign(){
     if(navigator.appName == "Microsoft Internet Explorer"){
         var pgTables = document.getElementsByTagName('table');
         for(var i=0; i<pgTables.length; i++){
            if(pgTables[i].className == 'bigbox'){     //checks for presence
of bigbox class on ad div, even though it is not a parent
                 var flashObjs = document.getElementsByTagName('object');
                 for(var j=0; j<flashObjs.length; j++){
                     
if(flashObjs[j].width==300||flashObjs[j].style.width=="300"||flashObjs[j].style.width=='300px'){

                            flashObjs[j].styleFloat = 'right';      //this
fixed the first ad. The following code is what I need help on.
                            parNode = flashObjs[j].parentNode;
                            while(parNode){
                                  parNode.style.position = 'static';
//relative, static, none?
                                  parNode.style.styleFloat = 'right';
                                  parNode.align = 'right';
//this fixes some of the elements that have align attributes set.
                                  parNode.style.height = '250px';    //tried
to set height of parent to ad height, but this would set all parents to one
height and I don't see any effects of that
                                  parNode.height = '250';

                                  /*the above is not working quite right. I
have tried numerous things on these parents - setting the position (as you
can see here, and I don't know whether float overrides, substitutes, etc.),
z-index (they have some z-index settings that are in the DOM viewer), size
of the parents, etc. What I am currently getting is a correctly floated ad,
but the divs, that surround the ad stretch the space behind the ad down the
page about 700px or so. I put a background color on the parents just to
debug it and got a red box the size of the ad about 500 px down the page in
the aformentioned spot. It's like there are height settings on the divs,
hence my changing of the parent heights as mentioned. I think there is
something with them being positioned absolutely or statically, etc. I guess
I don't understand what the correct settings should be.*/

                                 
if(parNode.parentNode.outerHTML.indexOf('adpos')>-1){
//a div that I inserted in the ad code, but is not a parent (the issue
wherein this fix is needed)
                                       break;
                                  }
                                  parNode = parNode.parentNode;
                             }
                      }
               }
          }
     }
}
window.onload = setTimeout("restoreAlign()",3000);

On 4/24/06, Christopher <[email protected]> wrote:
>
>
>
> You're partly correct--
>
> My point was that the original poster was trying to place elements
> back into the flow, but that the 'float' was going to prevent this
> from happening (see [1] and [2])--which it does. So the
> 'position:static;' declaration I picked out of the sample code is
> going to have no effect on the POSITION of the element it's applied to
> and the element is still going to be removed from the flow.
>
> It will only have a noticeable effect if any of the child elements of
> the div it's applied to are absolutely positioned. If no child
> elements are absolutely positioned, then the position declaration is
> superfluous.
>
> -Christopher
>
> [1] floats: http://www.w3.org/TR/CSS21/visuren.html#floats
> [2] positioning: http://www.w3.org/TR/CSS21/visuren.html#choose-position
>
>
>
>  Unsubscribe
> [email protected]
>
> List info
> http://www.quirksmode.org/dom/list.html
>
>
>  ------------------------------
> YAHOO! GROUPS LINKS
>
>
>    -  Visit your group "wdf-dom <http://groups.yahoo.com/group/wdf-dom>"
>    on the web.
>
>    -  To unsubscribe from this group, send an email to:
>     [email protected]<[email protected]?subject=Unsubscribe>
>
>    -  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
>    Service <http://docs.yahoo.com/info/terms/>.
>
>


[Non-text portions of this message have been removed]



Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/