确定 sifr 何时完成?
如何确定 sifr 已完成运行? 我需要知道页面加载时存在 sifr 文本的元素的高度,但是当我检查高度时,sifr 尚未完成,并且我得到一个不正确的值(应用 sifr 之前元素的高度)。 我绝对希望避免在查找高度时任意延迟。 有什么建议么?
How can I determine that sifr is finished running? I need to know the height of an element where there is sifr text on page load, but when I check the height, sifr has not yet completed and I get an incorrect value (the height of the element before sifr has been applied). And I definitely want to avoid having to place an arbitrary delay in finding the height. Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
onReplacement
回调,每次替换元素时都会调用该回调。 它被指定为 sIFR.replace() 的参数,更多信息请参见: http://wiki.novemberborn.net/sifr3/JavaScript+Methods。从那里开始,您将使用
FlashInteractor
对象,它是作为第一个参数传递,以获取替换的元素。但请注意,当调整页面大小时,文本可能会换行,从而更改 Flash 影片的高度。 对此没有回调。
You could use the
onReplacement
callback, which is invoked each time an element is replaced. It's specified as an argument tosIFR.replace()
, more here: http://wiki.novemberborn.net/sifr3/JavaScript+Methods.From there on you'd use the
FlashInteractor
object, which is passed as the first argument, to get to the replaced element.Do note though that when the page resizes, the text could wrap, changing the height of the Flash movie. There is no callback for this.
我花了很多时间在这上面,最后想出了一个跨浏览器的 jQuery 解决方案。 我希望这对处于类似情况的一群人有所帮助:
I spent a TON of time on this and finally came up with a cross-browser jQuery solution. I hope this helps a bunch of people in similiar situations: