The
article by Shitov (Lebedev Studio) describes a fully functioning fixed.
They got my hands to create such a fixed and decided to use the proposed solution.
But it did not work. I began to study the source code of the article (well, it works there) and eventually found out that the matter is in the DOCTYPE. As Lebedev is known to put on him, and here I wrote it. It was he who turned off fixed in IE.
1st option Back to quirks
If you specify a doctype, then the whole concept flies into the air. It’s pretty easy to make it so that the code is valid and everything works (after 2 hours of Google's foreign language)
Before doctype put an empty HTML comment. Wherein:
1. The w3c validator says that the code is correct.
2. Ognennolis recognizes the doctype and works in accordance with it.
3. IE tupit - does not find the doctyp on the first line and goes into compatibility mode. Fixed works.
4 Opera on the computer is not worth it - I will not say anything.
')
2nd option Forward to DOCTYPEs
Why is this happening?
Everything is very simple as usual. Shitov uses
document.body.scrollTop ; as, by the way, the majority of Internet users, inasmuch as Yandex looked for it gave me just such a wording (and they also teach pseudo-programmers from JS on the Internet, this can be said about essentially following the w3c standard without going into philosophical aspects ).
And in the standard compliance mode, the object model of IE changes and you need to use
document.documentElement.scrollTop .
Checked
Code
body{
padding:5em 0 0 0;
}
h1{
position:fixed;
_position:absolute;
top:0;
_top:expression(eval(document.documentElement.scrollTop));
left:0;
margin:0;
padding:0;
background:lime;
}
h1 - really on top, but now only with DOCTYPE