[thelist] DHTML Scrolling Area
Noah St. Amand
noah at tookish.net
Thu Jan 10 16:21:03 CST 2008
On 10-Jan-08, at 4:43 PM, Lee Kowalkowski wrote:
> On 10/01/2008, Noah St. Amand <noah at tookish.net> wrote:
>> What I can't figure out is how to make it loop smoothly, i.e., to
>> have
>> the 9 slide across the container followed by the 0 1 2 3 etc. Right
>> now, when it gets to the end (9), it stops and starts over again.
>
> Hmm, seems there are three options, so, easiest to hardest...
Given my lack of skills (and, as it happens, time), I'm going to go
with easiest for now :-).
> 1/ Add 100% horizontal padding either side so content enters from
> right and leaves completely before it restarts.
I had actually tried this. It works on the left side (i.e., the text
starts outside the div), but not on the right -- it still resets as
soon as the last character appears, rather than after it scrolls
across. I've updated the example:
<http://tookish.net/temp/scroll.html>
I think I need to add the offsetWidth of the container somewhere in
here to tell it to wait until the contents has scrolled across, but
I've tried various permutations with no success:
if (box.scrollLeft < (box.scrollWidth - box.offsetWidth)) {
box.scrollLeft = box.scrollLeft + 1
}
Any ideas?
Thanks again,
Noah
More information about the thelist
mailing list