jQuery中height、innerheight和outerheight的区别
来源:互联网 发布:慈禧为什么杀光绪 知乎 编辑:程序博客网 时间:2024/05/16 14:37
1.jQuery中的height()、innerheight()、outerheight()
1.1 获取/设置对应选择器标签的高度
$("div").height(); 获取
$("div").height(100); //设置
当然你也可以使用function设置对应标签的高度
$("button").click(function(){
//index为当前元素的索引 height是原始高度
$("div").height(function(index,height){
return height+10;
});
});
1.2 innerHeight这个很简单 直接获取就可以了
$("div").innerHeight();
1.3 outerHeight(option) option是bool值 默认是false
使用和你简单 :div.outerHeight() div.outerHeight(true)
另外的三个宽度同理类比就可以了
总结:参考上面的盒子模型图,height是获取content的高度, innerHeight = content的高度 + padding-top + padding=bottom
outHeight参数为false的话 outHeight = 上面的innerHeight + border-top + border-bottom
为true:outHeight = innerHeight + border-top + border-bottom + margin-top + margin-bottom
阅读全文
0 0
- jQuery中height、innerheight和outerheight的区别
- jquery innerHeight(),outerHeight(),height()的区别
- jQuery height()、innerHeight()、outerHeight()函数的区别
- jQuery中的.height()、.innerHeight()和.outerHeight()的区别
- Jquery(JS)中.height()和.innerHeight(),outerHeight()的差别
- jquery的height(),innerHeight(),outerHeight()
- jQuery的height、innerHeight、outerHeight三者的区别
- jQuery height()、innerHeight()、outerHeight()函数的区别详解
- (转)jQuery height()、innerHeight()、outerHeight()函数的区别详解
- jQuery中的height()、innerheight()、outerheight()的区别总结
- jquery height() innerHeight () outerHeight( )
- jQuery中的 height innerHeight outerHeight区别
- jQuery中的.height()、.innerHeight()和.outerHeight()
- jQuery中的.height()、.innerHeight()和.outerHeight()
- jQuery中的height(),innerHeight()和outerHeight()
- jquerr对象的height()/innerHeight()/outerHeight()/outerHeight(true)区别
- 比较height(),innerHeight(),outerHeight()和outerHeight(true)
- jQuery中height()、innerheight()、outerheight()有什么不同
- Java多线程详解
- ASP.net 解析 JSON字符串得到数组
- python url 解析
- 多线程(一)
- VMware Workstation Pro 12.x build-4352439 注册码/激活码
- jQuery中height、innerheight和outerheight的区别
- React Native 常用的技术
- Alpha、Beta、RC、Release软件版本的含义 svn 目录结构
- x264 码率控制:ABR模式
- PAT B1032. 挖掘机技术哪家强
- 传感器-光感和指南针
- 处理高并发访问数据库问题
- win32 线程优先级 SetThreadPriority
- 找到二叉树中符合搜索二叉树条件的最大拓扑结构