当回流导致元素改变大小时如何收到通知
我们的网站使用 Websocket,因此它已经需要最新型号的浏览器。鉴于此,当元素调整大小时如何通知我?我们可能有 canvas 和 svg 子元素,需要调整大小以响应父 DOM 元素的大小调整。
优雅的方法是挂钩“onresize”,但遗憾的是,它不会在元素上调用(至少在 Chrome 18 中不会)。宁愿不提供定期触发计时器来测试元素大小变化的答案。
另外,请理解,回流可能不是由窗口或正文调整大小引起的,所以请不要去那里。
任何精彩、简单、优雅的想法都会受到极大的赞赏。
Our site uses Websocket, so it already requires late-model browsers. Given that, how can I be notified when an element resizes? We may have canvas and svg child elements that need to resize in response to the parent DOM element resizing.
Elegant method would be to hook 'onresize' but, alas, it does not get called on elements (at least not in Chrome 18). Would prefer to not be offered an answer to periodically fire a timer to test for a change in element size.
Also, please understand that the reflow may not be caused by the window or body being resized, so please don't go there.
Any brilliant, simple, elegant ideas would be hugely appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论