up.element.styleNumber(element, prop)
JavaScript function
Returns a computed CSS property value for the given element, cast as a number.
The value is cast by removing the property's unit (which is usually px for computed properties).
The result is then parsed as a floating point number.
Returns undefined if the property value is missing. Returns NaN if the value cannot be parsed as a number.
Examples
let value = up.element.style(element, 'font-size')
// value is '16px'
value = up.element.styleNumber(element, 'font-size')
// value is 16
Parameters
element
required
Type: Element
prop
required
A single property name in kebab-case.
Type: string
Return value
The cast property value.
Type: number | undefined | NaN