PDA

View Full Version : Pausing up-down message scroller



newpotato
03-04-2006, 07:12 PM
Script:Pausing up-down message scroller
http://www.dynamicdrive.com/dynamicindex2/crosstick.htm

Is there anyway I can add some padding to the messages, so they don't butt right up against the edge of the message box?
Thank!

jscheuer1
03-04-2006, 07:55 PM
Yes. First you need to take back a bit of the layout control from the script. Near the end, you will see these lines:


document.writeln('<div id="first2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:1px;">')
document.write(messages[0])
document.writeln('</div>')
document.writeln('<div id="second2" style="position:absolute;width:'+scrollerwidth+';left:0px;top:0px;visibility:hidden">')

Get rid of the red parts.

Now you can control these divisions from a style section that you can put in the head of the page (for example):


<style type="text/css">
#main2 div div {
margin:0 5px;
width:140px;
}
</style>

The important thing to note is that 140px is 10px less than the scroller width as set in the script's configuration:


var scrollerwidth='150px'

This gives us 5px on either side for our margins as declared in the style section. If you use a different width scroller, adjust things accordingly.

newpotato
03-04-2006, 08:44 PM
Thanks! That's a great solution.

ddadmin
03-05-2006, 03:39 PM
Wow looking at this script it sure contains a lot of ugly and legacy code. But then again, I think this was one of the very first scripts I added to DD many years ago.

I'll rewrite this script and probably post the new version sometime this week. :)