@main[]
^header[True fixed in MSIE]
^maindir[2]
Andrey Shitov
^email[ash;]
True |
| Task: |
Show what it takes to emulated CSS-property position: fixed.
| ||
|
Stylesheet code that allows fixing an element on the page is a known thing. Our technologists use different techniques whichever one they fancy the most.
top: expression(document.body.scrollTop + "px"); But this elementary code doesn&6;t work, so here are three other ways:
top: expression( eval(document.body.scrollTop) + "px" );
top: expression(
document.getElementsByTagName("body")[0].scrollTop + "px"
);
top: expression( parseInt(document.body.scrollTop, 10) + "px" ); | See Vladimir Tokmakov&6;s article &7;Fixed positioning in IE&8; |
This block is fixed when you scroll up/down and
in MSIE.
Roma Voronezhsky and Yura Vasilchikov have come up with a strikingly simple solution&1;you can avoid jitter by fixing the page background: body
{
background: url('/n.gif') no-repeat;
background-attachment: fixed;
}
File n.gif is a one-pixel transparent image (and you don&6;t even have to upload it to server). This approach works well for all browsers starting from MSIE 5. Note: Keep in mind that for MSIE 7 there is a better way to deal with |