开发者

Determine fluid or fixed width in JavaScript

开发者 https://www.devze.com 2023-03-04 01:12 出处:网络
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.Typi

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

精彩评论

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