Jump to content

Custom Js Events


MrFish
 Share

Recommended Posts

I'm making my own scrollbars for panels on this site (because you cannot customize the real scrollbars with css yet) and I've got a question about custom events. Currently my panel+scrollbar looks like this-customscrollbar.jpgand I would like an onchange event that would recalculate the size and location of the scroll bar if the contents of the panel change. There is an onchange event only for select forms but is there any way I could get this for changing html? The current event is onmouseover but this is inconvenient for the user.

Link to comment
Share on other sites

The only way you could change the content is through JavaScript, so why not just put the recalculation logic after the content-changing logic?

Link to comment
Share on other sites

I don't really see how Change -> Event -> Handler -> Resize is simpler than Change -> Resize, but anyway... :)

Link to comment
Share on other sites

In any case, programmatically changing HTML content would not trigger an event. Many elements support a non-spec scroll event, but in FF anyway it doesn't seem to fire unless the user literally hits the scrollbar or the mouse's scrollwheel. Even if a div is set to overflow:auto, adding text to it programmatically does not trigger a scroll event.EDIT: Oops. You can force a scroll event if you adjust the element's scrollTop property, even when a div is set to overflow:hidden. (In FF SF and Chrome, anyway.) I'm not sure if that makes things easier, though. And I haven't checked IE.

Edited by Deirdre's Dad
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...