JQuery获取、设置样式height、width的值
2012-08-20 17:16
344 查看
(1)今天学会了用JQuery怎样获取、设置样式的高度和宽度
(2)
eq:
<p style="width:20em;">This is just a test.</p>
width() 取得第一个匹配元素当前计算的宽度值(px)。
示例:
$("p").width();
//设置内容为自拉伸的is
<script type="text/javascript">
$(function () {
var st = $(".VideoNote");
if (st.height() < 378) {
$(".VideoNote").css("height", "379");
}
})
</script>
(2)
eq:
<p style="width:20em;">This is just a test.</p>
width() 取得第一个匹配元素当前计算的宽度值(px)。
示例:
$("p").width();
//设置内容为自拉伸的is
<script type="text/javascript">
$(function () {
var st = $(".VideoNote");
if (st.height() < 378) {
$(".VideoNote").css("height", "379");
}
})
</script>
相关文章推荐
- jquery之修改元素样式(获取和设置样式,使用css(),width(),height()方法)
- jquery获取设置元素宽高位置height()、width()、offset()、position()、scrollTop()、scrollLeft()
- jquery的DOM节点获取,节点内容获取和设置,样式写入
- js、jquery获取、设置元素属性与样式
- jQuery无法获取隐藏元素(display:none)宽度(width)和高度(height)的新解决方案
- [jQuery]无法准确获取隐藏元素(display:none)宽度(width)和高度(height)的新解决方案
- jquery 获取元素width height 小数点向上取整
- 使用jquery获取各种height和width
- jQuery常用样式操作实例分析(获取、设置、追加、删除、判断等)
- JQuery中获取或设置样式和尺寸
- js获取和设置DOM样式函数cssStyle(类似于jquery的$(elem).css())
- 2015-07-22 JQuery 第二课(JQ元素获取,添加,删除,判断,遍历,取值,样式设置,改变对象,切换)
- 使用jquery中width()\height()方法获取各种宽高度大全
- Jquery 的outerHeight和outerHeightWidth
- jquery获取下拉框的值、设置下拉框的值
- jQuery设置和获取span的内容 (详解)
- JavaScript / jQuery 设置、获取元素属性 值 设置style样式
- jquery设置并获取select的相关操作的代码编写
- jquery 设置输入框背景样式透明,按钮背景样式保存不变
- jquery 尺寸位置(height/width/offset/scrollTop/scrollLeft)