views:

262

answers:

1

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 needed. I need to fire off an even when the scrollHeight and scrollWidth of the container div are changed.

No, don't want to use the scroll event because 1) scroll doesn't get fired when you just start dragging an element to the edge and the scrollHeight/scrollWidth change. 2) scroll fires when the scrollHeight/scrollWidth doesn't change.

Any hints?

+1  A: 

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.

jitter
Well, they can't be that proprietary. They seem to work in well in Firefox. Although, your comment prompted me to check in Chrome, where it's a no go.Is there a better way to get the dimensions of a div that has overflow with scroll bars?
Pridkett
Check expanded answers for citations about my statements
jitter
Okay, this looks like the answer, even if it isn't the answer to the question I was asking. In reality I was asking the wrong question and should be bludgeoned for using non-standard compliant extension. Thanks for the pointers.
Pridkett