javascript - Using "bottom: expression (0+ ... ;" for IE 6 Fixed Positioning -


It seems that I'm just missing some syntax or doing wrong, but on a specific style sheet Locking remains visible on the top of the scene-port, and despite the scrolling:

  top: expression (0 + ((e = document.documentElement.scrollTop)? E: document.body .scrollTop) + 'pixels');  

But, it does not lock on the bottom like this:

  Below: Expression (0 + ((e = document.documentElement scrollBottom) E: Document.body.scrollBottom) + 'pixels');  

Any ideas?

There is no such property scrollbottom .

Below is the distance between the lower edge of the element located and the lower edge of the block contained. Assuming the element is not within any of the other elements located, which is an initial block containing, effectively the initial viewport in the convention.

So when the viewport scrolls down from its initial (top) position, then move down position to negative to move it downwards Required:

  // Set to script. It is more reliable than solifing for solfing. If your page has a standard mode theory, // which is really needed in this century, then you do not need it, // you can always use document.documentElement. // var root = document.compatMode === 'CSS1Compat'? Document.documentElement: document.body; / * Then: * / head: expression (root.scrollTop + 'px'); / * Or: * / below: expression (-root scrollTop + 'px');  

There is still another IE6 bug where setting the bottom style of a perfectly-positioned element is actually relative to the current viewpoint position rather than the initial viewpoint state. So in fact you will set down to 0 all the time, even if it already has 0 ...

I will not personally use expression for anything, even an IE6 hack only. It is very unreliable, because it can not always tell when it needs recalculation. For me, I do not usually see recalculation on the scroll; Better to capture

onscroll and onresize . Example

DOCTYPE html public "- // W3C // DTD XHTML 1.0 link // n" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" & gt; & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" & gt; & Lt; Head & gt; & Lt; Style type = "text / css" & gt; Body {margin: 0; } #tools {status: Fixed; Z-index: 9; Bottom: 0; Left: 0; Width: 100%; Height: 24px; Background: silver; } & Lt; / Style & gt; & Lt; / Head & gt; & Lt ;! - [If lte IE 6] & gt; & Lt; Body class = "ie6" & gt; & Lt ;! [Endif] - & gt; & Lt ;! - [If GT IE 7]> gt; & Lt ;! - & gt; & Lt; Body & gt; & Lt ;! - & lt ;! [AndIf] - & gt; & Lt; Div id = "tools" & gt; ... & lt; / Div & gt; ... & lt; Script type = "text / javascript" & gt; // IE 6 Status: fixed fixed / fixed fixed (element, isbottom) {var root = document.compatMode === 'CSS 1 compact'? Document.documentElement: document.body; Function setPosition () (ifbottom) element.style.top = (root.scrollTop + root.clientHeight-element.offsetHeight) + 'px'; Else element.style.top = root.scrollTop + 'px';} Element .style.position = 'complete'; Window.attachEvent ('onscroll', setPosition); Window.attachEvent ('onresize', setPosition); Window.setInterval (setposition, 5000);} if (document.body.className == = 'Ie6') fixFixed (document.getElementById ('tools'), true); / script> gt; & gt; & gt; & lt; / html & gt;

Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -