Is there an event that fires on changes to scrollHeight or scrollWidth in jQuery?

[DISCLAIMER] Note that some parts of this answer are no longer accurate. scrollHeight and scrollWidth are now part of the CSSOM Spec and have much broader support 1 2


I don't think there is support for such a task. And why should there be one?

scrollHeight and scrollWidth are not part of any W3C specification or technical recommendation and AFAIK are MSIE proprietary DHTML object model extensions.

You can check for yourself even the MSDN pages state it that there is not standard for this MSDN scrollWidth property, MSDN: scrollHeight property.

Most browsers seem to support it, but as actually nobody "really" knows how IE implements them, you could get different behavior depending on browser.

Most browsers probably took an educated guess at what IE does and afterwards fix "bugreports" of users. But especially Opera (and now Chrome?) is(are) known to report "incorrect" values for this two properties.


I have answered this question here, which may seem irrelevant however it does support scrollHeight Change too and scrollWidth.

Detecting when a div's height changes using jQuery

Plugin:

http://www.jqui.net/jquery-projects/jquery-mutate-official/

Demo:

$('.selector').mutate('scrollHeight',function (){
    alert('it has changed the scroll height do something about it...');
});

This plugin also should work cross browser as it is using intervals (setTimeout) to check for such changes, it can also be extended should you need it :)

hope it helps...