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

前端 未结 2 1863
心在旅途
心在旅途 2021-01-04 00:39

I\'m using JQuery to design an application where the user can drag elements inside of a div that automatically adds scrollbars and expands the scrollHeight/scrollWidth as ne

2条回答
  •  旧时难觅i
    2021-01-04 01:21

    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.

提交回复
热议问题