PDA

View Full Version : memory scroller RTL direction..



Macpire
06-24-2006, 12:22 AM
Hi all =)

I'm trying to fit this Scroller to move from the left to the right for RTL text

The Scroller (http://www.dynamicdrive.com/dynamicindex2/memoryscroller.htm)

I'm trying to mess around with the style.left.. style.right.. the < and > signs and other info, but i couldn't make it :(

please if someone with a little more knowledge of DOM JS could help me it will be great!

thank you very much!

djr33
06-24-2006, 12:42 AM
Well, I really don't have any idea of what is going on inside most of the script, but by just playing with the numbers in it, I found a way to do it:


Find this, the second paragraph under the //NO NEED TO EDIT comment:
var divonclick=(persistlastviewedmsg && persistmsgbehavior=="onclick")? 'onClick="savelastmsg()" ' : ''
memoryspeed=(document.all)? memoryspeed : Math.max(-1, memoryspeed-10) //slow speed down by 1 for NS
var copyspeed=memoryspeed
var pausespeed=(pauseit==0)? copyspeed: 0
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-10000px">'+memorycontent+'</span>')
var actualwidth=''
var memoryscroller

The values in red are what need to be changed.
The first one was 1, and now is -1... makes sense, right? Negative=backwards...
The other one... just by trial and error, found that it needed to be bigger. It was 1, but that didn't allow it to go backwards (no idea why), and changing from 1 to 10 made it work.

WARNING: This is just chopping at the script til it works; I'm not sure what will be different about it now; perhaps someone else can explain the "correct" way or why this is, if it is, wrong.

Anyway... that should work for you. I'd recommend trying different numbers, and seeing what works for you.

Macpire
06-24-2006, 12:57 AM
Math.max(1, memoryspeed-1) //slow speed down by 1 for NS
this one says : make the speed lower for Netscape based browser...

I've been able to find how to cnahge the direction, it was easy ;) make sence like you said but in here...


function scrollmarquee(){
if (parseInt(memoryscroller.style.left)>(actualwidth*(-1)+8))
memoryscroller.style.left=parseInt(memoryscroller.style.left)+copyspeed+"px"
else
memoryscroller.style.left=parseInt(memorywidth)+8+"px"
}


this this function I've changed the - to + (mark in red) to make the style.left grow instead of shrinking, so its moving to the right but....

the problem is that i can't find the way to set the init position to be at the left side instead of the right side, and how to change the IF (mark is blue) to answer the question "when to go back to the start"

thanks again, and i hope someone else will post another solution :)

Macpire
06-24-2006, 01:35 AM
:D


function scrollmarquee(){
if (parseInt(memoryscroller.style.left)<parseInt(memorywidth))
memoryscroller.style.left=parseInt(memoryscroller.style.left)+copyspeed+"px"
else
memoryscroller.style.left=-actualwidth+"px"
}

so ..
IF the memoryscroller.style.left is < from the memorywidth
keep pushing it the the right by add +copyspeed to it

ELSE set the memoryscroller.style.left to the -actualwidth

:))

djr33
06-24-2006, 07:51 AM
Hmm.. alright. What I did worked in Safari and Mozilla.
Again, never said it was the "right" way :)
Glad you figured it out.

alhakeem2001
06-30-2006, 04:21 PM
:( It didn't work with me !!:confused: please can you write the whole script here or just email it to me .

Email : alhakeem2001@hotmail.com

Thanks,


Omar