Skip to content

bbarakaci/computed-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Computed Style

Get computed styles of dom elements

Getting Started

Download the production version or the development version.

Place it in your file

<script src="computed-style.min.js"></script>

Api

getAll(element)

Returns the native Css declaration of the browser. It is a collection of all the computed styles of the element.

var styles = computedStyle.getAll(element);

get(element, name)

Returns the computed value for given style name

var marginTop = computedStyle.get(element, 'marginTop');

toFloat(value)

Gets rid of 'px' values returning a floating nuber or 0

var number = computedStyle.toFloat('120px');

getFloat(element, name)

Gets the floating number value of the given style name of an element.

var number = computedStyle.getFloat(element, 'marginTop');

About

Get computed styles of dom elements

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published