[thelist] onScroll event?

Andreas Wahlin Andreas.Wahlin at ufl.gu.se
Tue Dec 21 06:10:34 CST 2004


Is there some way to detect when you scroll an element?
Scenario is that I want dropshadow on the text of a div, so I just put
in another div with a slight offset and ... drop shadow!
Now, if the text in that div is large, there be scrollbars, and if
clicked, the div obviously scrolls the text, leaving the dropshadow
behind. 
It could of course be solved by firing a setInterval and checknig the
scrollTop attribute on the text div, and then apply that to the
dropshadow div, but it would be nice to have a onScroll event or
something ...

Btw, for other fun uses of scrollTop, check out
http://www.atarilegend.com/music/jukebox.php
Where I detect clicks on the arrow images to change the scrollTop on the
divs with the artist/song text. I'm a bit proud of the result since it's
loads of eye candy, but you can disable it (right click upper corner)
and have semantic (?) html instead. Only problem is Opera and NS that
doesen't seem  to want to scroll down when you have overflow set to none
on the divs. Perhaps I should try to hide the scrollbar instead, but
that would be really ugly. Oh, and IE for some extremely strange reason
doesen't seem to keep the scrolled positions when you take a trip round
the server ... Which is very strange because I apply the same scrollTop
value as it had before, works in FF though. So there are some issues to
be worked out for sure ...
Any critique on the jukebox is very welcome! 
(I didn't do the server side scripting, only the client side)

Andreas


More information about the thelist mailing list