开发者

Determine fluid or fixed width in JavaScript

Is there a reliable way to tell whether a web page's layout is fixed or fluid? I don't care if it required a library like jQuery or MooTools so long as it's rea开发者_如何学编程sonably accurate.


Typical width methods are going to give you pixels, but there's an answer here which should give you (in most cases) a percentage width if it is defined as such: get CSS rule's percentage value in jQuery

Suspected caveats with this method:

  • The width is declared in the first stylesheet (this could be modified as appropriate to search all stylesheets).
  • The width isn't an inline style.
  • You know the major container element of the page (this would be an issue with any method).
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜