get-style-property

0.1.1 • Public • Published

get-style-property

Gets the current value of a style property for a given DOM element.

browser support

var foo              =  document.querySelector('.foo')
  , getStyleProperty =  require('get-style-property');

// assuming we applied css: ".foo { min-height: 20px }"

console.log(getStyleProperty(foo, 'min-height')); // => 20px

API

/**
 * Gets the current value of a style property for a given DOM element.
 *
 * @function
 * @param el {Object} The DOM element.
 * @param propName {String} The name of the property.
 * @return {String} The current value of the element's style and given property. 
 */
getStyleProperty(el, propName)

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    210
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    210
  • 0.1.0
    0

Package Sidebar

Install

npm i get-style-property

Weekly Downloads

154

Version

0.1.1

License

MIT

Last publish

Collaborators

  • thlorenz