MrFish Posted February 24, 2010 Share Posted February 24, 2010 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-and 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 More sharing options...
Synook Posted February 24, 2010 Share Posted February 24, 2010 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 More sharing options...
MrFish Posted February 24, 2010 Author Share Posted February 24, 2010 I could, but I was just trying to make it simpler. Link to comment Share on other sites More sharing options...
Synook Posted February 25, 2010 Share Posted February 25, 2010 I don't really see how Change -> Event -> Handler -> Resize is simpler than Change -> Resize, but anyway... Link to comment Share on other sites More sharing options...
jeffman Posted February 25, 2010 Share Posted February 25, 2010 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.