Skip to content

Latest commit

 

History

History
30 lines (20 loc) · 963 Bytes

File metadata and controls

30 lines (20 loc) · 963 Bytes

@function jQuery.styles jQuery.styles @parent jquerypp @signature jQuery.(el).styles([style], [value])

jQuery.styles provides jQuery.fn.styles to rapidly get a set of computed styles from an element.

Quick Example

$("#foo").styles('float','display') //->
// {
//  cssFloat: "left", display: "block"
// }

Use

An element's computed style is the current calculated style of the property. This is different than the values on element.style as element.style doesn't reflect styles provided by css or the browser's default css properties.

Getting computed values individually, for example by using jQuery .css(), is expensive. This plugin retrieves all needed style properties at once.

Demo

The following demo illustrates the performance improvement jQuery.fn.styles provides by implementing a faster 'height' jQuery function called 'fastHeight'.

@demo jquerypp/dom/styles/styles.html 300