[thelist] DHTML Scrolling Area

Noah St. Amand noah at tookish.net
Fri Jan 11 17:00:57 CST 2008

On 11-Jan-08, at 5:48 AM, Lee Kowalkowski wrote:

> I think it was just a case of styling your elements so you actually
> had the 400px space either side.  Hopefully you can follow my changes:

Thanks again -- I had actually arrived at something pretty similar,  
though a little less elegant.

It's up and running now, and seems to be doing the job.

There's one thing that's still bugging me, though it's not a huge  
deal. In order to make it work, I have to know the width of the  
contents, which comes from box.scrollWidth:

> var box = document.getElementById(container);
> var contents = box.getElementsByTagName('div')[0];
> contents.style.width = box.scrollWidth + box.offsetWidth + 'px';

I usually use an addEvent function to attach scripts to window.onload,  
rather than using <body onload="">. In this case, though, when I run  
the script at window.onload, box.scrollWidth returns the width of  
"box", rather than the width of "contents" with everything loaded into  
it. If I call it in the body tag using "onload", box.scrollWidth  
returns the width of "contents".

Anyway, it's working -- thanks again for your help.


More information about the thelist mailing list