jQuery.cssNumber Property
Definition and Usage
$.cssNumber refers to an object containing all CSS properties that can be used without a unit.
Tip: Used by .css() to determine whether to append px to unitless values.
By default, this object contains the following properties:
zIndex
fontWeight
opacity
zoom
lineHeight
widows (jQuery 1.6开始添加)
orphans (jQuery 1.6开始添加)
fillOpacity (jQuery 1.6.2开始添加)
columnCount (jQuery 1.9开始添加)
order (jQuery 1.10.2开始添加)
flexGrow (jQuery 1.11.1开始添加)
flexShrink (jQuery 1.11.1开始添加)
To prevent the .css() method from automatically adding the px unit to a specific CSS property, you can add an extra property to the jQuery.cssNumber object.
jQuery.cssNumber.someCSSProp = true;
Syntax
$
.cssNumber
jQuery Properties