In the trigger JS scroll event Ah, but I met is really not moving, I began to think it is FF above, did not think IE6 and IE7 have such effects, have to Marvel magic.
As I have found the following magic code: only the use of CSS to achieve scrolling effect ~ ~
#fixed {position:fixed;}
<div id= "fixed" > Rolling </div>
Finished, this property is done rolling, really want to curse. But not finished, this only support Firefox and IE7, I just said IE6 also can, but IE6 to achieve a bit complicated,
Copy Code code as follows:
<!--[If ie]>
<style type= "Text/css" >
* HTML #fixed {position:absolute;right:1px;top:expression_r (Eval_r (document.body.height + 500));}
* Html{overflow:hidden;}
* HTML Body{height:100%;overflow:auto;}
* HTML #fixed {right:17px;top:5em;}
* HTML #fixed {right:1px;top:expression_r (Eval_r (document.body.height + 500));}
</style>
<! [endif]-->
I do not see this too much meaning. Also seems to be CSS, but should also have a script it!? Maybe someone knows to tell you, share.
Now that my title is the N-way to implement scrolling, it's definitely not just the two kinds of things. Like CSS and other writing, I will not enumerate, I mainly want to tell you more commonly used JS implementation, my site is useful to a piece of code, but also on the internet to find, but there is a bad place is it is relatively top, that is, your Web page is not high enough will appear to pull the bottom of the situation, In fact, Baidu message will also appear this situation, I will not say more, first posted out to see:
Copy Code code as follows:
lastscrolly=0;
function HeartBeat () {
var Diffy;
if (document.documentelement && document.documentElement.scrollTop)
Diffy = Document.documentElement.scrollTop;
else if (document.body)
Diffy = Document.body.scrollTop
Else
{}
Percent=.1* (diffy-lastscrolly);
if (percent>0) Percent=math.ceil (percent);
else Percent=math.floor (percent);
document.getElementById ("Lovexin12"). Style.top=parseint (document.getElementById ("Lovexin12"). Style.top) + percent+ "px";
(document.getElementById ("Lovexin12"). Style.top) +percent+ "px";
Lastscrolly=lastscrolly+percent;
}
Window.setinterval ("HeartBeat ()", 1);
If you are interested, you can change the above to the bottom, so it will be much better.
Recently has been looking at the JS Library, more interested in jquery is very good, so ~, now to paste a use of jquery to achieve scrolling code, than the above this feeling much better. However, it is only a choice, there is no need to use, the jquery code also has dozens of KB.
Copy Code code as follows:
$ (document). Ready (function () {
if ($.browser.msie && $.browser.version = 6) {
Followdiv.follow ();
}
});
Followdiv = {
Follow:function () {
$ (' #cssrain '). CSS (' position ', ' absolute ');
$ (window). Scroll (function () {
var f_top = $ (window). scrolltop () + $ (window). Height ()-$ ("#cssrain"). Height ()-parsefloat ($ ("#cssrain"). CSS (" borderTopWidth "))-parsefloat ($ (" #cssrain "). CSS (" borderBottomWidth ");
$ (' #cssrain '). CSS (' top ', f_top);
});
}
}
All right, let's talk about it!! What do not understand can be proposed! The discussion will make progress ~! Welcome everyone to join my QQ group, we learn and progress together. Group number: 5678537