uTools-Manuals/docs/jQuery/jQuery.cssNumber.html
2019-04-21 11:50:48 +08:00

57 lines
2.9 KiB
HTML

<article class="" id="post-">
<header class="entry-header">
<h1 class="entry-title">jQuery.cssNumber</h1>
<div class="entry-meta">
所属分类:<span class="category"><a href="/category/css/">CSS</a></span><span class="category-divider"> | </span><span class="category"><a href="/category/manipulation/">DOM 操作</a> &gt; <a href="/category/manipulation/style-properties/">CSS 属性</a></span>
<span class="pull-right">英文文档:<a href="https://api.jquery123.com/jQuery.cssNumber/" target="_blank">jQuery.cssNumber</a></span>
</div><!-- .entry-meta -->
</header><!-- .entry-header -->
<article class="entry property" id="jQuery-cssNumber1"><h2 class="section-title">
<span>jQuery.cssNumber</span><span class="returns">Returns: <a href="http://api.jquery.com/Types/#Object">Object</a></span>
</h2>
<div class="entry-wrapper">
<p class="desc"><strong>Description: </strong>An object containing all CSS properties that may be used without a unit. The <a href="/css/"><code>.css()</code></a> method uses this object to see if it may append <code>px</code> to unitless values.</p>
<ul class="signatures"><li class="signature"><h4 class="name">
<span class="version-details">version added: <a href="/category/version/1.4.3/">1.4.3</a></span>jQuery.cssNumber</h4></li></ul>
<div class="longdesc" id="entry-longdesc">
<p>You can think about <code>jQuery.cssNumber</code> as a list of all CSS properties you might use without a unit. It's used by <a href="/css/"><code>.css()</code></a> to determine if it needs to add <code>px</code> to unitless values.</p>
<p>The keys of the <code>jQuery.cssNumber</code> object are camel-cased and the values are all set to <code>true</code>. If you want to prevent the <a href="/css/"><code>.css()</code></a> method from automatically adding the <code>px</code> unit for a specific CSS property, you can add an extra property to the <code>jQuery.cssNumber</code> object.</p>
<div class="syntaxhighlighter javascript">
<table>
<tbody>
<tr>
<td class="gutter">
<div class="line n1">1</div>
</td>
<td class="code">
<pre><div class="container"><div class="line"><code>jQuery.cssNumber.someCSSProp = <span class="literal">true</span>;</code></div></div></pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>By default the object contains the following properties:</p>
<ul>
<li><code>zIndex</code></li>
<li><code>fontWeight</code></li>
<li><code>opacity</code></li>
<li><code>zoom</code></li>
<li><code>lineHeight</code></li>
<li>
<code>widows</code> (added in jQuery 1.6)</li>
<li>
<code>orphans</code> (added in jQuery 1.6)</li>
<li>
<code>fillOpacity</code> (added in jQuery 1.6.2)</li>
<li>
<code>columnCount</code> (added in jQuery 1.9)</li>
<li>
<code>order</code> (added in jQuery 1.10.2)</li>
<li>
<code>flexGrow</code> (added in jQuery 1.11.1)</li>
<li>
<code>flexShrink</code> (added in jQuery 1.11.1)</li>
</ul>
</div>
</div></article>
</article>