Solved

Slow down a scrolling marquee in javascript....

Posted on 2008-10-21
3
1,483 Views
Last Modified: 2008-10-21
Hi, I have some parsed html I am palcing in a div, then applying Javascript to it to make it scroll - it was some free script i lifted off of the web.  The problem is, it looks like the speed can only be defined as a whole number - I have it set at "1" but it is still too fast - when I put in .75 or any fraction, it does not function - can anyone help with a solution?

Here is the script...

<script type="text/javascript">
var delayTime=5
var marqueeSpeed=1 //Here is where the problem is
var pauseTime=1
var copySpeed=marqueeSpeed
var pauseSpeed=(pauseTime==0)? copySpeed: 0
var actualHeight=''

function ScrollMarquee() {
  if (parseInt(crossMarquee.style.top)>((actualHeight / 2)*(-1)))
  crossMarquee.style.top=parseInt(crossMarquee.style.top)-copySpeed+"px"
  else
  crossMarquee.style.top=0 +"px"
}

function InitializeMarquee()
{
crossMarquee=document.getElementById("vmarquee")
crossMarquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualHeight=crossMarquee.offsetHeight;
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1)
{
crossMarquee.style.height=marqueeheight+"px"
crossMarquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("ScrollMarquee()",30)', delayTime)
}

if (window.addEventListener)
window.addEventListener("load", InitializeMarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", InitializeMarquee)
else if (document.getElementById)
window.onload=InitializeMarquee
etc...........


Thanks!!!
0
Comment
Question by:theclassic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 22768307
Increase delayTime
0
 
LVL 13

Accepted Solution

by:
crazyman earned 500 total points
ID: 22768322
sorry ignore that

try increasing this 30 which is the interval.
like...
setTimeout('lefttime=setInterval("ScrollMarquee()",100)', delayTime)
0
 

Author Comment

by:theclassic
ID: 22771686
Sorry - I know I accepted - but is there a way to make this scroll stop and fade - if it is something that is easy, you can answer - if not I can post again - Thanks for your help!
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SSRS Deployment problem 5 96
How to repeat the data 4 30
how to check mis-spellings in a select SQL 2 38
.NET - find out if application is running on Windows 2012 server 3 35
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question