jQuery错误的高度,由于@ font-face [英] jQuery working out wrong height, due to @font-face
问题描述
我有一个问题与jQuery和@ font-face。
I have a problem with jQuery and @font-face.
我需要计算出一个< div> / code>,它工作正常,但然后有一个小的延迟,字体加载,一旦他们这样做,@ font-face字体实际上大于后备字体,因此高度小于它应该是。
I need to work out the height of a <div>
, which works fine, but then there is a small delay for the fonts to load and as soon as they do, the @font-face fonts were actually bigger than the fallback fonts, so the height is smaller than it should be.
我已经尝试使用Modernizr,但是没有用,因为它只检测浏览器是否能够@ font-face,而不是字体是否
I have tried using Modernizr, but that is no use as it only detects if the browser is capable of @font-face, not whether the fonts have loaded yet or not.
jQuery代码位于$(document).ready,但我猜字体不会延迟启动。
The jQuery code is in $(document).ready, but I guess fonts don't delay that from firing. Any ideas anyone?
推荐答案
完美的解决方案是, Adam 指出,使用 $(window).load
而不是 $(document).ready
The perfect solution was, as Adam pointed out, using $(window).load
instead of $(document).ready
$(window).load(function(){
$(".column").equalHeights();
});
这篇关于jQuery错误的高度,由于@ font-face的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!