JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 9th, 2003, 04:17 PM
BatlANgl BatlANgl is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 1 BatlANgl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
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);
// -->

Reply With Quote
  #2  
Old August 8th, 2005, 01:16 AM
Mittineague's Avatar
Mittineague Mittineague is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jul 2005
Location: West Springfield, Massachusetts
Posts: 542 Mittineague User rank is Private First Class (20 - 50 Reputation Level)Mittineague User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 1 Day 2 h 58 m 28 sec
Reputation Power: 3
scroller bugs out

I have heard of this happening before. I myself have an image exchange script that uses the setTimeout function. It seems that the first time the function is called it "keeps tempo" but with subsequent calls it "bugs out" and will erratically "jump head" I believe it is a problem with the setTimeout function, not the script.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Scroller Bugs out, can't seem to get it to work perfectly


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway