views:

21

answers:

1

It's simple to observe the documents scroll event but I can't seem to find anything relating to the scroll of any other element with css property overflow being set?

To get around this myself i've been observing mousemove which only fires while you hold down on the scrollbar but this would need to be teamed with a mouse wheel observe also to get the full effect.

Could anyone point me in the right direction for a better way of implementing this?

A: 

You can use the onscroll event, which will fire whenever the element is scrolled, with the mouse wheel, page up/down keys or by dragging the scrollbar:

element.onscroll = function ()
{
    alert(this.scrollTop);
}

AFAIK, it is supported by IE5.5+, Firefox, Chrome, Safari and Opera but you can test any of them properly at quirksmode.org's test page.

Andy E
How strange when I did my testing last night this never seemed to fire. Cheers for the link to the Quirksmode test page will attempt to find out why mine never captured the event.
Phunky
Happy to help :-)
Andy E