Question about "floating div" JavaScript
I have a JavaScript that automatically moves a <div> element to the top-right portion of the clients screen when the screen is resized. This script works great in always presenting a particular element (floating layer <div>) I have on the page against the right margin irrespective of the client's screen resolution. However - the script not only moves the <div> to the right-most margin of the screen - but also moves the <div> vertically to keep it atop the screen when the page is scrolled, etc. I do NOT want the vertical (Y) functionality of the JavaScript. I wish for the <div> to be anchored at an absolute vertical position on the screen and not move when the page is resized, scrolled vertically. Can someone take a look at the following script and let me know what I need to do to eliminate the vertical (Y) repositioning of the div and keep it anchored at an absolute Y position? I thank you in advance.
<div id="picStrip" style="position:absolute; left: 348px; width: 900px; height: 152px; top: 86px;" align="right">
<img src="../images/strip_bldg.jpg"> <img src="../images/strip_board.jpg"> <img src="../images/strip_conf.jpg"> <img src="../images/strip_lobby.jpg"></div>
</div>
<script type="text/javascript">
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
var px = document.layers ? "" : "px";
function JSFX_FloatDiv(id, sx, sy)
{
var el=d.getElementById?d.getElementById(id):d.all?d.a ll[id]:d.layers[id];
window[id + "_obj"] = el;
if(d.layers)el.style=el;
el.cx = el.sx = sx;el.cy = el.sy = sy;
el.sP=function(x,y){this.style.left=x+px;this.styl e.top=y+px;};
el.flt=function()
{
var pX, pY;
pX = (this.sx >= 0) ? 0 : ns ? innerWidth :
document.documentElement && document.documentElement.clientWidth ?
document.documentElement.clientWidth : document.body.clientWidth;
pY = ns ? pageYOffset : document.documentElement &&
document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop;
if(this.sy<0)
pY += ns ? innerHeight : document.documentElement &&
document.documentElement.clientHeight ?
document.documentElement.clientHeight : document.body.clientHeight;
this.cx += (pX + this.sx - this.cx)/8;this.cy += (pY + this.sy - this.cy)/8;
this.sP(this.cx, this.cy);
setTimeout(this.id + "_obj.flt()", 1);
//this.id + "_obj.flt()";
}
return el;
}
JSFX_FloatDiv("picStrip", -906, 96).flt();
</script>
|