I'm having trouble with a ticker that I'm making.
I've found code on the net and I'm adjusting it to my needs.
However though it seems to be working well I do have an issue.
If I have a long text which exceeds the width of my div, it won't show that text anymore.
I'm trying to fix it but it won't work.
Expand|Select|Wrap|Line Numbers
- <html>
- <head>
- <style type="text/css">
- #tickercontainer
- {
- position: relative;
- width: 300px; /* width of the DIV containing the ticker */
- height: 19px; /* height of the DIV containing the ticker */
- background-color: white;
- background-image: url("bg.jpg");
- overflow: hidden;
- border: 0px solid black;
- padding: 2px;
- padding-left: 4px;
- }
- #ticker
- {
- font-family: Tahoma;
- color: #ffffff;
- font-weight: bold;
- background-color: red;
- }
- </style>
- <script type="text/javascript">
- var delay=0 //Specify the time (in milliseconds) you want to wait before the ticker starts (1000 = 1 seconds)
- var marqueespeed=1 //Specify the speed at which the ticker scrolls by (1:slow / 10:fast)
- var freeze=0 //Upon mouse over do you want to freeze the ticker so the user can click a link? (0:no / 1:yes)
- var copyspeed=marqueespeed
- var pausespeed=(freeze==0)? copyspeed: 0
- var actualwidth=''
- function scroll()
- {
- if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
- {
- cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+"px"
- }
- else
- {
- cross_marquee.style.left=parseInt(tickerwidth)+8+"px"
- }
- }
- function startticker()
- {
- cross_marquee=document.getElementById("ticker")
- tickerwidth=document.getElementById("tickercontainer").offsetWidth
- cross_marquee.style.left= tickerwidth;
- actualwidth=cross_marquee.offsetWidth;
- if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1)
- { //if Opera or Netscape 7x, add scrollbars to scroll and exit
- cross_marquee.style.height=marqueeheight+"px"
- cross_marquee.style.overflow="scroll"
- return
- }
- setTimeout('lefttime=setInterval("scroll()",30)', delay)
- }
- if (window.addEventListener)
- window.addEventListener("load", startticker, false)
- else if (window.attachEvent)
- window.attachEvent("onload", startticker)
- else if (document.getElementById)
- window.onload=startticker
- </script>
- </head>
- <body>
- <div id="tickercontainer" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">
- <div id="ticker" style="position: absolute; width: 98%;">
- <!--SCROLL CONTENT HERE-->
- Test 1 Test 2 Test 3 Test 4
- <!--SCROLL CONTENT HERE-->
- </div>
- </div>
- </body>
- </html>
But if you adjust the width of "tickercontainer" (in the style at the top of the page) so for example 150px, you'll see that the text isn't being scrolled completely.
So I would like to have my text scrolled entirely. Who can help me with this?
Thanks,
Cainnech