Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Chris</title>
<link href="thrColLiqHdr.css" rel="stylesheet" type="text/css" />
<style type="text/css">
.root {
position: absolute;
height: 140px;
width: 205px;
background-color: #F4F4F4;
}
.handle {
margin:2px;
padding:2px;
width: 98%;
color:white;
background-color: navy;
font-weight: bold;
}
</style>
</head>
<body>
<div class="container">
<div class="header" style="text-align:center;"><div id='cssmenu'>
<ul>
<li><a href='index.html'><span>Home</span></a></li>
<li class='active'><a href='ChrisPG.html'><span>Chris</span></a></li>
<li><a href='PiaPg.html'><span>Pia</span></a></li>
<li><a href='KyePg.html'><span>Kye</span></a></li>
<li><a href='sponsors.html'><span>Sponsors</span></a></li>
<li><a href='Livechat.html'><span>LiveChat</span></a></li>
<li><a href='About.html'><span>About</span></a></li>
<li class='last'><a href='Contact.html'><span>Contact</span></a><br/>
</li>
</ul>
</div>
</div>
<div class="root" id="root">
<div class="handle" id="handle">Handle</div>
<a href="Http://youtube.com.au"><img src="http://www.vicsjavascripts.org.uk/StdImages/1.gif" width="208" height="114"></a>
</div>
<div class="root" id="root">
<a href="Http://youtube.com.au"><img src="http://www.vicsjavascripts.org.uk/StdImages/1.gif" width="208" height="114"></a>
<div class="handle" id="handle">Handle</div>
</div>
<div class="root" id="root">
<img src="http://www.vicsjavascripts.org.uk/StdImages/1.gif" width="208" height="114">
</div>
<script type="text/javascript">
/*<![CDATA[*/
// Drag Drop (10-May-2013)
// by Vic Phillips - http://www.vicsjavascripts.org.uk/
var zxcDrag={
init:function(r,h,d){
var o=this,ds=this.bycls(document,r),d=typeof(d)=='number'?d:-1,xy,z,lft,top,z0=0;
for (;z0<ds.length;z0++){
h=this.bycls(ds[z0],h)[0];
h=h?h:ds[z0];
z=this.style(ds[z0],'z-Index');
ds[z0].style.zIndex=isFinite(z*1)?z*1:101;
xy=o.cookie('zxcdrag'+z0).split(',');
if (xy[1]){
ds[z0].style.left=xy[0]+'px';
ds[z0].style.top=xy[1]+'px';
}
lft=o.int(ds[z0],'left'),top=o.int(ds[z0],'top');
o.addevt(h,'mousedown','down',[ds[z0],'zxcdrag'+z0,[isFinite(lft)?lft:ds[z0].offsetLeft],[isFinite(top)?top:ds[z0].offsetTop]]);
}
o.days=d;
o.addevt(document,'mousemove','move');
o.addevt(document,'mouseup','up');
},
down:function(e,a){
var o=this;
o.lst?o.lst.style.zIndex=o.int(o.lst,'z-Index')-1:null;
a[0].style.zIndex=o.int(a[0],'z-Index')+1;
o.xy=[e.clientX,e.clientY];
o.drag=a;
return o.rtn(e);
},
move:function(e){
var o=this,d=o.drag,xy=[e.clientX,e.clientY];
if (d){
d[2][1]=d[2][0]+xy[0]-o.xy[0];
o.drag[0].style.left=d[2][1]+'px';
d[3][1]=d[3][0]+xy[1]-o.xy[1];
o.drag[0].style.top=d[3][1]+'px';
return o.rtn(e);
}
},
up:function(e){
var o=this,d=o.drag;
if (d){
this.lst=d[0];
d[2][0]=d[2][1];
d[3][0]=d[3][1];
document.cookie=d[1]+'='+[d[2][0],d[3][0]]+';expires='+(new Date(new Date().getTime()+o.days*86400000).toGMTString())+';path=/';
o.drag=false;
}
},
rtn:function(e){
if(e.stopPropagation){
e.stopPropagation();
}
if (!window.event){
e.preventDefault();
}
e.cancelBubble=true;
e.cancel=true;
e.returnValue=false;
return false;
},
int:function(o,p){
return parseInt(this.style(o,p));
},
style:function(o,p){
if (o.currentStyle){
return o.currentStyle[p.replace(/-/g,'')];
}
return document.defaultView.getComputedStyle(o,null).getPropertyValue(p.toLowerCase());
},
cookie:function(nme){
var re=new RegExp(nme+'[^;]+','i');
return document.cookie.match(re)?document.cookie.match(re)[0].split("=")[1]:'';
},
addevt:function(o,t,f,p){
var oop=this;
if (o.addEventListener){
o.addEventListener(t,function(e){ return oop[f](e,p);}, false);
}
else if (o.attachEvent){
o.attachEvent('on'+t,function(e){ return oop[f](e,p); });
}
},
bycls:function(obj,cls){
var els=obj.getElementsByTagName('*'),ary=[],z0=0;
for (;z0<els.length;z0++){
if ((' '+els[z0].className+' ').match(' '+cls+' ')){
ary.push(els[z0]);
}
}
return ary;
}
}
/*]]>*/
</script>
<script language="javascript">
zxcDrag.init('root','handle',1);
</script>
</body>
</html>
Bookmarks