.outerWidth()

outerWidth( [includeMargin] ) 1.2.6追加

戻り値:Integer

padding領域、border領域、margin領域をを含む要素の横幅を計算します。

引数 説明
includeMargin マージンを算出する横幅に含むか含まないかを決定します。
outer_width

デモ

PタグのouterWidthを取得します。

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <style>
  5. p { margin:10px;padding:5px;border:2px solid #666; }
  6. </style>
  7. <script src="http://code.jquery.com/jquery-latest.js"></script>
  8. </head>
  9. <body>
  10. <p>Hello</p><p></p>
  11. <script>var p = $("p:first");
  12. $("p:last").text( "outerWidth:" + p.outerWidth()+ " , outerWidth(true):" + p.outerWidth(true) );
  13. </script>
  14. </body>
  15. </html>

 Back to top

© 2010 - 2017 STUDIO KINGDOM