开发者

Can't get right width or outerWidth of <label> element

simply can not understand this problem I have 开发者_StackOverflow社区- 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.


Maybe you need .outerWidth(true) wich includes the margin of the element.

http://api.jquery.com/outerWidth/ for more specific information on the outerWidth function.


SOLUTION/PROBLEM: I used custom fonts - must be a workaround though - dont have time to find it yet :-D

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜