<! Doctype HTML>
<HTML>
<Head>
<Meta charset = "UTF-8">
<Title> untitled document </title>
<Style>
* {Margin: 0; padding: 0 ;}
. Box {position: relative; padding: 50px; border-bottom: 1px solid red ;}
. Box IMG {display: block; width: pixel PX; Height: 800px ;}
</Style>
<SCRIPT>
Window. onload = function ()
{
VaR aimg = Document. getelementsbytagname ('img ');
//
// The first screen
VaR winhsf-document.doc umentelement. clientheight;
For (VAR I = 0; I <aimg. length; I ++)
{
Aimg [I]. _ Top = getpos (aimg [I]). Top;
If (aimg [I]. _ top <winh)
{
Aimg [I]. src = aimg [I]. getattribute ('_ src ');
Aimg [I]. B = true; // switched
};
};
VaR obox1 = Document. getelementbyid ('box1 ');
VaR obox2 = Document. getelementbyid ('box2 ');
VaR Top = getpos (obox1). Top;
Window. onscroll = function ()
{Var scrolltop = Document. Body. scrolltop | document.doc umentelement. scrolltop;
VaR winhsf-document.doc umentelement. clientheight;
{For (VAR I = 0; I <aimg. length; I ++)
{
If (aimg [I]. B) continue;
If (aimg [I]. _ top <= winh + scrolltop)
{
// Aimg [I]. src = aimg [I]. getattribute ('_ src ');
(
Function (INDEX ){
VaR oimg = new image ();
Oimg. onload = function ()
{
Aimg [Index]. src = This. SRC;
};
Oimg. src = aimg [I]. getattribute ('_ src ');
}) (I );
Aimg [I]. B = true;
};
If (scrolltop> = top)
{
Obox1.style. Position = 'fixed ';
Obox1.style. Left = 0;
Obox1.style. Top = 0;
Obox2.style. Display = "Block ";
}
Else
{
Obox1.style. Position = "";
Obox2.style. Display = "NONE ";
};
};
};
};
};
Function getpos (OBJ)
{
VaR L = 0;
VaR T = 0;
While (OBJ)
{
L + = obj. offsetleft;
T + = obj. offsettop;
OBJ = obj. offsetparent;
};
Return {left: l, top: t };
};
</SCRIPT>
</Head>
<Body>
<Div class = "box">
</Div>
<Div class = "box">
</Div>
<Div class = "box">
<P> </P>
</Div>
<Div id = "box1" style = "display: block; Right: 0; width: 100%; padding: 10px; text-align: center; font-weight: bold; Background: # CCC; Z-index: 5555; ">
The body and soul are always on the road... </Div>
<Div style = "height: 120px; display: none;" id = "box2"> </div>
</Div>
<Div class = "box">
</Div>
<Div class = "box">
</Div>
<Div class = "box">
</Div>
<Div class = "box">
</Div>
<Div class = "box">
</Div>
</Body>
</Html>
Ceiling BAR + large image loading and scrolling