且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jQuery获取firefox中的自动计算边距

更新时间:2022-06-07 22:49:53

当你说它不工作时,你会收到错误(在控制台中)还是返回0?返回0表示自动设置显然是不同浏览器的问题。

When you say it doesn't work, do you receive errors (in the console) or does it return 0? Returning 0 for the auto setting is, apparently, an issue with different browsers.

您可以使用轻量级 jSizes 库,它返回所有指标(以像素为单位)。这将节省你不得不使用outerWidth等。

You could use the lightweight jSizes library which returns all metrics in pixels. This will save you having to faff around with outerWidth, etc..