CSS Styler
A fast and lightweight cross-browser function for setting and getting DOM styles. 6x faster than using jQuery.css().
Install
NPM + Browserify (recommended)
First install CSS Styler in your project root.
$ npm install css-styler
Then include in your module using require().
var css = ;
File include
Download the latest css.global.min.js from http://github.com/InventingWithMonster/css-styler and include it in your HTML document with a script tag, ie:
This will load CSS Styler to the global scope as window.css
, accessible in any script executed subsequently.
Use
CSS Styler takes two arguments: Your DOM element, and either an object of CSS properties (to set), or the name of a CSS property (to get). It will automatically find any prefixed versions of your property and set those instead.
Set
;
Get
; // Returns '#F00'