在jQuery中对scrollHeight或scrollWidth进行更改时会触发事件吗? [英] Is there an event that fires on changes to scrollHeight or scrollWidth in jQuery?

查看:301
本文介绍了在jQuery中对scrollHeight或scrollWidth进行更改时会触发事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JQuery设计一个应用程序,用户可以在其中拖动div内的元素,从而自动添加滚动条并根据需要扩展scrollHeight/scrollWidth.即使容器div的scrollHeight和scrollWidth发生了变化,我也需要开除.

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.

否,不想使用scroll事件,因为1)当您刚开始将元素拖动到边缘并且scrollHeight/scrollWidth更改时,scroll不会被触发. 2)当scrollHeight/scrollWidth不变时,滚动会触发.

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.

有任何提示吗?

推荐答案

我认为不支持此类任务.为什么要有一个?

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

scrollHeightscrollWidth不是任何W3C规范或技术建议的一部分,而AFAIK是MSIE专有的DHTML对象模型扩展.

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

您甚至可以检查自己的MSDN页面,指出该

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

大多数浏览器似乎都支持它,但是实际上没有人真正"知道IE是如何实现它们的,因此,根据浏览器的不同,您可能会得到不同的行为.

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

大多数浏览器可能会对IE所做的事情进行了有根据的猜测,然后修复了用户的错误报告".但是众所周知,尤其是Opera(现在是Chrome?)报告了这两个属性的"不正确"值.

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.

这篇关于在jQuery中对scrollHeight或scrollWidth进行更改时会触发事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆