Solved

Slow down a scrolling marquee in javascript....

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now