|
1 | 1 | <?xml version="1.0"?>
|
2 |
| -<entry type="method" name="innerWidth" return="Number"> |
| 2 | +<entries> |
| 3 | + <desc>Get the current computed inner width (including padding but not border) for the first element in the set of matched elements or set the inner width of every matched element.</desc> |
| 4 | +<entry type="method" name="innerWidth" return="Integer"> |
3 | 5 | <title>.innerWidth()</title>
|
4 | 6 | <signature>
|
5 | 7 | <added>1.2.6</added>
|
6 | 8 | </signature>
|
7 |
| - <desc>Get the current computed width for the first element in the set of matched elements, including padding but not border.</desc> |
| 9 | + <desc>Get the current computed inner width for the first element in the set of matched elements, including padding but not border.</desc> |
8 | 10 | <longdesc>
|
9 | 11 | <p>This method returns the width of the element, including left and right padding, in pixels.</p>
|
10 | 12 | <p>This method is not applicable to <code>window</code> and <code>document</code> objects; for these, use <code><a href="/width/">.width()</a></code> instead.</p>
|
@@ -36,3 +38,62 @@ $( "p:last" ).text( "innerWidth:" + p.innerWidth() );
|
36 | 38 | <category slug="manipulation/style-properties"/>
|
37 | 39 | <category slug="version/1.2.6"/>
|
38 | 40 | </entry>
|
| 41 | + |
| 42 | +<entry type="method" name="innerWidth" return="jQuery"> |
| 43 | +<signature> |
| 44 | + <added>1.8.0</added> |
| 45 | + <argument name="value"> |
| 46 | + <type name="String"/> |
| 47 | + <type name="Number"/> |
| 48 | + <desc>A number representing the number of pixels, or a number along with an optional unit of measure appended (as a string).</desc> |
| 49 | + </argument> |
| 50 | +</signature> |
| 51 | +<signature> |
| 52 | + <added>1.8.0</added> |
| 53 | + <argument name="function(index, width)" type="Function"> |
| 54 | + <desc>A function returning the inner width (including padding but not border) to set. Receives the index position of the element in the set and the old inner width as arguments. Within the function, <code>this</code> refers to the current element in the set.</desc> |
| 55 | + </argument> |
| 56 | +</signature> |
| 57 | +<desc>Set the CSS inner width of each element in the set of matched elements.</desc> |
| 58 | +<longdesc> |
| 59 | + <p>When calling <code>.innerWidth("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 for the width (such as <code>100px</code>, <code>50%</code>, or <code>auto</code>). Note that in modern browsers, the CSS width property does not include padding, border, or margin, unless the <code>box-sizing</code> CSS property is used.</p> |
| 60 | + <p>If no explicit unit is specified (like "em" or "%") then "px" is assumed.</p> |
| 61 | +</longdesc> |
| 62 | +<example> |
| 63 | + <desc>Change the inner width of each div the first time it is clicked (and change its color).</desc> |
| 64 | + <code><![CDATA[ |
| 65 | +var modWidth = 60; |
| 66 | +$( "div" ).one( "click", function() { |
| 67 | +$( this ).innerWidth( modWidth ).addClass( "mod" ); |
| 68 | +modWidth -= 8; |
| 69 | +}); |
| 70 | +]]></code> |
| 71 | + <css><![CDATA[ |
| 72 | +div { |
| 73 | +width: 60px; |
| 74 | +padding: 10px; |
| 75 | +height: 50px; |
| 76 | +float: left; |
| 77 | +margin: 5px; |
| 78 | +background: red; |
| 79 | +cursor: pointer; |
| 80 | +} |
| 81 | +.mod { |
| 82 | +background: blue; |
| 83 | +cursor: default; |
| 84 | +} |
| 85 | +]]></css> |
| 86 | + <html><![CDATA[ |
| 87 | +<div>d</div> |
| 88 | +<div>d</div> |
| 89 | +<div>d</div> |
| 90 | +<div>d</div> |
| 91 | +<div>d</div> |
| 92 | +]]></html> |
| 93 | +</example> |
| 94 | +<category slug="css"/> |
| 95 | +<category slug="dimensions"/> |
| 96 | +<category slug="manipulation/style-properties"/> |
| 97 | +<category slug="version/1.8"/> |
| 98 | +</entry> |
| 99 | +</entries> |
0 commit comments