PDA

View Full Version : loading <div>



Disaster-sama
12-05-2006, 08:33 PM
im not sure how it works but, i was wondering how does the "loading" icon can be displayed on screen on a certain position even when you scoll down or up?
i found that gmail has that, but when i use the script the loading icon does not follow the scroll and stays in the same position. any help?

12345c
12-07-2006, 03:32 PM
This script corrects position when scrolling window. Attach it to layer with "loading".


<script>d=document;g=function(X){return d.getElementById(X);}
d1top=200;d1left=120;
onscroll=function(){g('d1').style.top=d1top+d.body.scrollTop;g('d1').style.left=d1left+d.body.scrollLeft;}
if(self.addEventListener)addEventListener('DOMMouseScroll',function(){setTimeout(onscroll,1)},!1);
(genBr5x=function(N){while(N)d.write(N--+'<br><br><br><br><br>');}
)(20)
</script>
<div id=d1 style="position:absolute;top:200px;left:120px;border:1px solid red">Floating div</div>
</body></html>