无法获得< label>的正确宽度或outerWidth元件 [英] Can't get right width or outerWidth of <label> element

查看:139
本文介绍了无法获得< label>的正确宽度或outerWidth元件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根本无法理解这个问题 - 我需要< label> .outerWidth() >元素,但是它会一直返回一个不同于我可以从我的firebug中读出的值?

.outerHeight 工作得很好。



已解决自我注意:自定义字体和宽度的计算如果你使用的是自定义字体,你必须使用 .outerHeight。 方法在 $(window).load(function(){} ,而不是 $(document).ready(function (){} 。第一种情况等待加载窗口的所有元素(包括自定义字体和图像),否则在加载自定义元素之前准备好第二种情况。它不知道它的维度。


simply can not understand this problem I have - I need the .outerWidth() of a <label> element, but it keeps returning a value that is different from the one I can read out of my firebug?

.outerHeight works just fine though.

SOLVED: Note to self: custom fonts and calculations of width does not work all that well, lol

解决方案

When you use custom fonts, you must use the .outerHeight method on $(window).load(function(){}, not $(document).ready(function(){}. The first case waits for all the elements of the window to be loaded (including the custom font and the image) otherwise in the second case it is ready before the custom element is loaded and it not know the dimension of it.

这篇关于无法获得&lt; label&gt;的正确宽度或outerWidth元件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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