国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

jQuery獲得包含margin的outerWidth和outerHeight的方法

2019-11-20 12:51:41
字體:
供稿:網(wǎng)友

本文實(shí)例講述了jQuery獲得包含margin的outerWidth和outerHeight的方法。分享給大家供大家參考。具體如下:

<!DOCTYPE html><html><head><script src="js/jquery.min.js"></script><script>$(document).ready(function(){ $("button").click(function(){  var txt="";  txt+="Width of div: " + $("#div1").width() + "</br>";  txt+="Height of div: " + $("#div1").height() + "</br>";  txt+="Outer width of div (margin included): " + $("#div1").outerWidth(true) + "</br>";  txt+="Outer height of div (margin included): " + $("#div1").outerHeight(true);  $("#div1").html(txt); });});</script></head><body><div id="div1" style="height:100px;width:300px;padding:10px;margin:3px;border:1px solid blue;background-color:lightblue;"></div><br><button>Display dimensions of div</button><p>outerWidth(true) - returns the width of an element (includes padding, border, and margin).</p><p>outerHeight(true) - returns the height of an element (includes padding, border, and margin).</p></body></html>

希望本文所述對(duì)大家的jQuery程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宁武县| 宜春市| 黄平县| 轮台县| 海原县| 玉门市| 灵璧县| 桃江县| 石台县| 拉萨市| 白玉县| 庄浪县| 黔江区| 石首市| 莒南县| 嘉定区| 泊头市| 武宣县| 灌云县| 文安县| 谷城县| 桂林市| 深泽县| 固安县| 澜沧| 合川市| 鹤庆县| 绵阳市| 凌云县| 昌黎县| 措勤县| 会东县| 安顺市| 当雄县| 全南县| 瓮安县| 荥经县| 田东县| 陆丰市| 丹巴县| 新泰市|