The code is as follows |
Copy Code |
var tips; var thetop = 250/* This is the default height * *; var old = thetop; function Initfloattips () { Tips = document.getElementById (' floattips '); Movetips (); }; function Movetips () { var tt=50; if (window.innerheight) { pos = Window.pageyoffset } else if (document.documentelement && document.documentElement.scrollTop) { pos = Document.documentElement.scrollTop } else if (document.body) { pos = Document.body.scrollTop; } Pos=pos-tips.offsettop+thetop; POS=TIPS.OFFSETTOP+POS/10; if (POS < thetop) pos = thetop; if (pos!= old) { Tips.style.top = pos+ "px"; tt=10; } Old = pos; SetTimeout (MOVETIPS,TT); } $ (document). Ready (function () { Initfloattips (); }) |
div ID name to and JS in the corresponding, the following is a CSS style, you can define their own needs:
The code is as follows |
Copy Code |
div#floattips{ Position:absolute; padding:3px; bottom:0px; right:0px; z-index:9999; } |