Jquery / Javascript(またはより正確な他の方法)を使用して要素の幅と高さを計算するのに最適な方法を知りたいです。現在、私はこのJqueryメソッドを使用しています。
Jquery:私の例を参照してください: http: //jsfiddle.net/AwkF5/1/
var w = $("#wrapper"); //The element dimensions to calculate
$("#displayW").text( "outerWidth:" + w.outerWidth()+ " , outerWidth(true):" + w.outerWidth(true) ); // Displaying the width in the #displayW div
$("#displayH").text( "outerHeight:" + w.outerHeight()+ " , outerHeight(true):" + w.outerHeight(true) ); // Displaying the height in the #displayH div
これは、要素の幅/高さ(コンテンツ、パディング、境界線を含む)とTRUEの幅/高さ(コンテンツ、パディング、境界線、マージンを含む)を計算する最も正確な方法ですか?
プレーンなjavascriptメソッドは何でしょうか?
divの背景画像を作成し、そのサイズを知りたいので、質問しています...幅と高さはブラウザによって異なることに注意してください...明らかに
ありがとうございました
</ p>