jquery 操作css 尺寸

时间:2022-04-23
本文章向大家介绍jquery 操作css 尺寸,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

.height()   获取元素集合中的第一个元素的当前计算高度值,或设置每一个匹配元素的高度值。   .height()     获取匹配元素集合中的第一个元素的当前计算高度值。     这个方法不接受参数。     $(window).height(); 获取头像的高度。     $(document).height()   .height(value)     设置每一个匹配元素的高度值。     value 一个整数代表的像素数,默认为像素px。     .height(function(index,height))     返回用于设置高度的一个函数。index 参数表示元素在集合中的位置,     height 参数表示原来的高度,this 指向元素集合中的当前元素。     $("div").one("click",function(){       $(this).height(30)     })

.innerHeight()   用于获得匹配集合中第一个元素的当前计算的内部高度(包括padding 但不包括border 或设置每一个匹配元素的内部高度)   .innerHeight()     这个方法不接受任何参数。     p.innerHeight() 获取p元素的高度   .innerHeight(value)     为匹配元素设置css 内部高度。   .innerHeight(function)     一个函数用返回设置内部高度,     $( this ).innerHeight( modHeight ) 设置当前元素的高度。 .innerWidth()   用于获得匹配集合中第一个元素的当前计算的内部宽度(包括padding 但不包括border 或设置每一个匹配元素的内部宽度)    .innerWidth()     这个方法不接受任何参数。     p.innerWidth() 获取p元素的宽度    .innerWidth(value)     为匹配元素设置css 内部高度。    .innerWidth(function)     一个函数用返回设置内部高度,     $( this ).innerWidth( modWidth) 设置当前元素的宽度。 .width()   获取元素集合中的第一个元素的当前计算宽度值,或设置每一个匹配元素的宽度值。   .width()     获取匹配元素集合中的第一个元素的当前计算宽度值。     这个方法不接受参数。   $(window).width(); 获取头像的宽度。   $(document).width()   获取元素集合中的第一个元素的当前计算宽度值,或设置每一个匹配元素的宽度值。   .width(value)     设置每一个匹配元素的宽度值。     value 一个整数代表的像素数,默认为像素px。   .width(function(index,width))     返回用于设置宽度的一个函数。index 参数表示元素在集合中的位置,     width 参数表示原来的宽度,this 指向元素集合中的当前元素。      $("div").one("click",function(){         $(this).width(30)       }) .outerHeight()   获取匹配元素集合中第一个元素的当前计算高度值。包括padding border 和部分margin 在空集合上返回null;   .outerHeight([includeMargin])     includeMargin 一个布尔值,表明是否在计算机时包含元素的margin 值。margin (top 和 bottom)。   p.outerHeight( true ) 获取p 元素的高度值,包括margin。    .outerHeight(value)     为匹配集合中的每个元素设置css 外部高度。     value : 一个表示像素的数字。 .outerHeight(function(index,height))     function 一个函数,返回值用来设置外部高度值。     $( this ).outerHeight( modHeight ) 获取当前元素的高度包括。 .outerWidth()   获取匹配元素集合中第一个元素的当前计算宽度值。包括padding border 和部分margin 在空集合上返回null;   .outerWidth([includeMargin])     includeMargin 一个布尔值,表明是否在计算机时包含元素的margin 值。margin (top 和 bottom)。   p.outerHeight( true ) 获取p 元素的宽度值,包括margin。   .outerWidth(value)     为匹配集合中的每个元素设置css 外部宽度。     value : 一个表示像素的数字。   .outerWidth(function(index,height))     function 一个函数,返回值用来设置外部宽度值。     $( this ).outerWidth( modHeight ) 获取当前元素的宽度包括。