floating div along with scrollbars (horizontal and vertical)

I need a div(image in it) to float along with the scrollbars.
I implemented using position: fixed. but it is not working in IE 6.
so i used the script given in http://www.javascript-fx.com/submitscripts/float/float.html 
It is working fine for vertical scroll (height wise).
the link also has example 3 which scrolls width wise. but it will not scroll along with the horizontal scroll bar.

please give me the script/css which can work on IE6 that will float the div along with the scrollbars
divyasindhuAsked:
Who is Participating?
 
divyasindhuConnect With a Mentor Author Commented:
I got it working with the help of following links:
http://www.howtocreate.co.uk/fixedPosition.html
http://mauzon.com/?p=72
 
 
0
 
ellandrdCommented:
Please post your code snippet.
0
 
divyasindhuAuthor Commented:
// this div has a large image.
//the user can select a part of the image and save (crop image)
<div id="originalDiv" style="z-index:0;">
<img src="<html:rewrite page="<%=imageParam%>"/>" id="uploadedImage" />
</div>
//the preview wrap will contain the preview of the selected portion of the large image
<div id="floatingDiv" style="position: absolute;z-index:1;">
        <div id="previewWrap">
        </div>
<html:submit value="Save" styleClass="cssButton"></html:submit>
</div>  
// i am using the following script to float the preview image
// the horizontal float is working.
//but the div is not moving horizontally

<script type="text/javascript">
var ns = (navigator.appName.indexOf("Netscape") != -1);
var d = document;
function JSFX_FloatDiv(id, sx, sy)
{
var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
var px = document.layers ? "" : "px";
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.style.top=y+px;};
el.floatIt=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.floatIt()", 40);
}
return el;
}
JSFX_FloatDiv("floatingDiv", 10,30).floatIt();
</script>
0
 
divyasindhuAuthor Commented:
A correction in the submitted code comments
the vertical float is working. but the horizontal float is not working
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.