Solved

Slow down a scrolling marquee in javascript....

Posted on 2008-10-21
3
1,481 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
  • 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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