
April 9th, 2003, 04:17 PM
|
|
Junior Member
|
|
Join Date: Apr 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Scroller Bugs out, can't seem to get it to work perfectly
Hi!
First time posting. Here is my problem, I modified some code I found on SimplytheBest.net for a vertical scroller. I was able to add in an array of various messages which are triggered depending on which image you put your mouse over. My problem is that when i go from one image to another too quickly, the scrolling text starts to bug out. Can anyone help me?
Here is an example of one image tag. The others would be the same other than the name, the src and the value in the displayMsg() function.
Code:
<img name="image3" src="img/neutral-tips.gif" onMouseOut="image3.src='img/neutral-tips.gif'; PerformScroll(7); return document.returnValue;" onMouseOver=" image3.src='img/blue-tips.gif'; displayMsg(2); PerformScroll(-7); return document.returnValue;">
Here is the style for my divContainer and divContent:
Code:
#divContainer {left:155px; visibility:hidden; overflow:hidden; width:500px; clip:rect(0px 500px 40px 0px); position:absolute; top:30px; height:40px;}
#divContent {left:0px; position:absolute; top:0px; color:696969; font-family:tahoma; font-size:8pt;}
In my html document all I have for the divContainer and divContent is this:
Code:
<div id="divContainer">
<div id="divContent">
</div>
</div>
And here is my javaScript code:
Code:
/*
Further modified by Edward H. Cho (EdwardHCho@hotmail.com)
Extension written by David G. Miles (URL)
based in part on code written by Thomas Brattli (URL)*/
// Courtesy of SimplytheBest.net (URL)
<!--
function verifyCompatibleBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new verifyCompatibleBrowser()
var speed=50
var loop, timer
var textsize=5
var msgID = 0
var message = new Array()
message[0] = "This is the home message, nigga!"
message[1] = "And this will be the music message."
message[2] = "This will of course be the tips scroller."
message[3] = "Tools' message goes here."
message[4] = "and last but not least, forum headliner."
function ConstructObject(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4 ?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style :bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height: this.el.offsetHeight
this.clipHeight=bw.ns4?this.css.clip.height:this.e l.offsetHeight
this.up=MoveAreaUp;this.down=MoveAreaDown;
this.MoveArea=MoveArea; this.x; this.y;
this.obj = obj + "Object"
eval(this.obj + "=this")
return this
}
function displayMsg(id) {
divContent.innerHTML="<span>"+message[id]+"</span>";
document.close();
}
function MoveArea(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}
function MoveAreaDown(move){
if(this.y>-10){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".down("+move+")",speed)
}
else CeaseScroll();
}
function MoveAreaUp(move){
if(this.y<0){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+".up("+move+")",speed)
}
else CeaseScroll();
}
function PerformScroll(speed){
if(initialised){
loop=true;
if(speed>0) objScroller.down(speed);
else objScroller.up(speed)
}
}
function CeaseScroll(){
loop=false
if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
objContainer=new ConstructObject('divContainer')
objScroller=new ConstructObject('divContent','divContainer')
objScroller.MoveArea(0,-15)
objContainer.css.visibility='visible'
initialised=true;
}
function findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}
function reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
// -->
|