Generate CSS With JavaScript – JSS.js

Category: Javascript , Recommended | June 19, 2017
Author: Box9
Views Total: 1,456
Official Page: Go to website
Last Update: June 19, 2017
License: MIT

Preview:

Generate CSS With JavaScript – JSS.js

Description:

JSS.js is a JavaScript library for handling CSS which allows to dynamically set and retrieve CSS rules with JavaScript.

Basic usage:

Just load the JavaScript file JSS.js in the document and you’re ready to go.

<script src="jss.js"></script>

You can add a new rule (or extend an existing rule) as follows:

jss.set('code', { color: teal; });

You can retrieve the rules for a specific CSS selector as follows:

jss.getAll('code');

This will return an object:

{"color":"teal"}

You can also completely remove an existing rule using:

jss.remove('code');

You Might Be Interested In:


Leave a Reply