PDA

View Full Version : CSS Menu highlight and Dock Content script



Lonewolf
05-18-2010, 09:30 PM
1) Script Title: CSS Menu highlight and Dock Content script

2) Script URL (on DD):
<html>

<head><style>
A.menulink {
display: block;
width: 53px;
text-align: center;
text-decoration: none;
font-family:Monotype Corsiva;
font-size:40px;
color: #0000FF;
BORDER: 5px;
border: solid 1px #FF0000;
}

A.menulink:hover {
border: solid 1px #FF0000;
background-color:#FF0000;
}

</style><script>

/*
CSS Menu highlight- By Marc Boussard (marc.boussard@syntegra.fr)
Modified by DD for NS4 compatibility
Visit http://www.dynamicdrive.com for this script
*/

var ns4class=''
</script>

<script type="text/javascript">



var offsetfromedge=0 //offset from window edge when content is "docked". Change if desired.
var dockarray=new Array() //array to cache dockit instances
var dkclear=new Array() //array to cache corresponding clearinterval pointers

function dockit(el, duration){
this.source=document.all? document.all[el] : document.getElementById(el);
this.source.height=this.source.offsetHeight;
this.docheight=truebody().clientHeight;
this.duration=duration;
this.pagetop=0;
this.elementoffset=this.getOffsetY();
dockarray[dockarray.length]=this;
var pointer=eval(dockarray.length-1);
var dynexpress='dkclear['+pointer+']=setInterval("dockornot(dockarray['+pointer+'])",100);';
dynexpress=(this.duration>0)? dynexpress+'setTimeout("clearInterval(dkclear['+pointer+']); dockarray['+pointer+'].source.style.top=0", duration*1000)' : dynexpress;
eval(dynexpress);
}

dockit.prototype.getOffsetY=function(){
var totaloffset=parseInt(this.source.offsetTop);
var parentEl=this.source.offsetParent;
while (parentEl!=null){
totaloffset+=parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function dockornot(obj){
obj.pagetop=truebody().scrollTop;
if (obj.pagetop>obj.elementoffset) //detect upper offset
obj.source.style.top=obj.pagetop-obj.elementoffset+offsetfromedge+"px";
else if (obj.pagetop+obj.docheight<obj.elementoffset+parseInt(obj.source.height)) //lower offset
obj.source.style.top=obj.pagetop+obj.docheight-obj.source.height-obj.elementoffset-offsetfromedge+"px";
else
obj.source.style.top=0;
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

</script>


<body> <table id="dockcontent0" class="dockclass" <table BORDER=4 BORDERCOLOR=#FF0000 > <tr>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-A.html" class="menulink" class=&{ns4class};><strong>A </strong></a>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-B.html" class="menulink" class=&{ns4class};><strong>B </strong></a>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-C.html" class="menulink" class==&{ns4class};><strong>C </strong></a></td>
</a></td>
</table>
<script type="text/javascript">

var dock0=new dockit("dockcontent0", 0);
var dock1=new dockit("dockcontent1", 10);

</script>
</body>
</html>

3) Describe problem: I can not get this to work:confused: I have spent several hours and days working on it - I have no clue as to what i am doing wrong. PLEASE HELP!

honey_6611
07-22-2010, 10:10 AM
Replace your table with the following table... Hopefully it should work

<table id="dockcontent0" class="dockclass" BORDER="4" BORDERCOLOR="#FF0000" >
<tr>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-A.html" class="menulink" ><strong>A </strong></a></td>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-B.html" class="menulink" ><strong>B </strong></a></Td>
<td width="0%"><a href="E:\LONEWOLF'S WEBPAGE FILES\LONEWOLF'S MOVIE'S\movie file complete\LONEWOLF'S MOVIES-C.html" class="menulink" ><strong>C </strong></a></td>
</tr>
</table>