Skip to content

Commit 80d53f0

Browse files
committed
outerWidth: document method as a setter
Fixes jquerygh-98 Closes jquerygh-648
1 parent aaea07c commit 80d53f0

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

entries/outerWidth.xml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<?xml version="1.0"?>
2+
<entries>
3+
<desc>Get the current computed width for the first element in the set of matched elements, including padding and border.</desc>
24
<entry type="method" name="outerWidth" return="Number">
35
<title>.outerWidth()</title>
46
<signature>
@@ -42,3 +44,62 @@ $( "p:last" ).text(
4244
<category slug="manipulation/style-properties"/>
4345
<category slug="version/1.2.6"/>
4446
</entry>
47+
<entry type="method" name="outerWidth" return="jQuery">
48+
<signature>
49+
<added>1.8.0</added>
50+
<argument name="value">
51+
<type name="String"/>
52+
<type name="Number"/>
53+
<desc>A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string).</desc>
54+
</argument>
55+
</signature>
56+
<signature>
57+
<added>1.8.0</added>
58+
<argument name="function(index, width)" type="Function">
59+
<desc>A function returning the outer width to set. Receives the index position of the element in the set and the old outer width as arguments. Within the function, <code>this</code> refers to the current element in the set.</desc>
60+
</argument>
61+
</signature>
62+
<desc>Set the CSS outer width of each element in the set of matched elements.</desc>
63+
<longdesc>
64+
<p>When calling <code>.outerWidth(value)</code>, the value can be either a string (number and unit) or a number. If only a number is provided for the value, jQuery assumes a pixel unit. If a string is provided, however, any valid CSS measurement may be used (such as <code>100px</code>, <code>50%</code>, or <code>auto</code>).</p>
65+
</longdesc>
66+
67+
<example>
68+
<desc>Change the outer width of each div the first time it is clicked (and change its color).</desc>
69+
<code><![CDATA[
70+
var modWidth = 60;
71+
$( "div" ).one( "click", function() {
72+
$( this ).outerWidth( modWidth ).addClass( "mod" );
73+
modWidth -= 8;
74+
});
75+
]]></code>
76+
<css><![CDATA[
77+
div {
78+
width: 60px;
79+
padding: 10px;
80+
height: 50px;
81+
float: left;
82+
margin: 5px;
83+
background: red;
84+
cursor: pointer;
85+
}
86+
.mod {
87+
background: blue;
88+
cursor: default;
89+
}
90+
]]></css>
91+
<html><![CDATA[
92+
<div>d</div>
93+
<div>d</div>
94+
<div>d</div>
95+
<div>d</div>
96+
<div>d</div>
97+
]]></html>
98+
</example>
99+
100+
<category slug="css"/>
101+
<category slug="dimensions"/>
102+
<category slug="manipulation/style-properties"/>
103+
<category slug="version/1.8"/>
104+
</entry>
105+
</entries>

0 commit comments

Comments
 (0)