...

View Full Version : how do you do a floating movable div/layer



emehrkay
01-22-2006, 07:25 PM
i've been looking for tutorials/scrips all day and i can not find anything. i assume that its not too difficult, just updating the x y position of the layer with the mouse x y etc, im just not too sure about the rest of the package. any ideas?

thanks

_Aerospace_Eng_
01-22-2006, 07:39 PM
http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow.htm

emehrkay
01-22-2006, 07:41 PM
thank you, i thought i looked through all of dd

vwphillips
01-22-2006, 08:12 PM
best google for position:fixed

but

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
<!--

function zxcWWHS(){
if (document.all){
zxcCur='hand';
zxcWH=document.documentElement.clientHeight;
zxcWW=document.documentElement.clientWidth;
zxcWS=document.documentElement.scrollTop;
if (zxcWH==0){
zxcWS=document.body.scrollTop;
zxcWH=document.body.clientHeight;
zxcWW=document.body.clientWidth;
}
}
else if (document.getElementById){
zxcCur='pointer';
zxcWH=window.innerHeight-15;
zxcWW=window.innerWidth-15;
zxcWS=window.pageYOffset;
}
zxcWC=Math.round(zxcWW/2);
return [zxcWW,zxcWH,zxcWS];
}


window.onscroll=function(){
var img=document.getElementById('fred');
if (!document.all){ img.style.position='fixed'; window.onscroll=null; return; }
if (!img.pos){ img.pos=img.offsetTop; }
img.style.top=(zxcWWHS()[2]+img.pos)+'px';
}
//-->
</script>

</head>

<body >
<div id="fred" style="position:absolute;left:100px;top:100px;" >
<img src="http://www.vicsjavascripts.org.uk/StdImages/One.gif" width=200 height=200 style="position:absolute;top:0px;left:0px;" >
</div>
<div style="position:absolute;overflow:hidden;left:0px;top:0px;width:100%;" >
<br>
<br>
<center> Here Is some Content
<br>
<img src="http://www.vicsjavascripts.org.uk/StdImages/Blank.gif" width="1" height="1000">
The End
</center></div>
</body>
</html>
should give you a start



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum