Home  >  Article  >  Web Front-end  >  Example of usage of outerWidth() method in jQuery_jquery

Example of usage of outerWidth() method in jQuery_jquery

WBOY
WBOYOriginal
2016-05-16 16:19:311008browse

The example in this article describes the usage of outerWidth() method in jQuery. Share it with everyone for your reference. The specific analysis is as follows:

This method gets the outer width of the first matching element.
By default the outer height is the sum of width, padding and border.
If the parameter is set to true, the outer margin size will also be included in the outer width.
This method works for both visible and hidden elements.
Can be combined with outerHeight() method to learn.

Grammar structure:

Copy code The code is as follows:
$(selector).outerWidth(options)

Parameter list:
参数 描述
options 定义是否把外补白(margin)计算在内:
一.fase,外补白不计算在内,默认值。
二.true,外补白计算在内。

实例代码:

复制代码 代码如下:






outerWidth()函数-脚本之家





 
此处显outerWidth()数值

 


点击按钮可以显示div的元素外部宽度。

希望本文所述对大家的jQuery程序设计有所帮助。

本文转自:蚂蚁部落http://www.softwhy.com/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn