Pjt.js is a JavaScript library. Its current main function is converting raw CSS into js styles and toggling CSS.
- Download the latest Pjt.js release.
- Link to your page
<script src="pjt.js"></script>
- link the latest version of pjt.js to your page
<script src="https://rawgit.com/pjtsearch/Pjt.js/master/pjt.js"></script>
PCSS.css(css);
Add in raw CSS converted to JS styles.
css: Regular raw CSS (media queries not supported).
example:
PCSS.css(` body{ background:blue; border: 1px solid black; } #a{ color:red; border:5px solid green; } `);
*Note: back ticks can be used in JS for multi-line strings as shown above.
P(element).toggleCss(style, togglestyle);Toggles a raw CSS style with another raw CSS style.
element: CSS element selector.
style: Raw CSS style to be toggled with togglestyle (MUST HAVE 1 SPACE AFTER : AND HAVE A ;).
togglestyle: Raw CSS style to be toggled with style (MUST HAVE 1 SPACE AFTER : AND HAVE A ;).
example:
P('#a').toggleCss('color: blue;', 'color: red;');
P(element).toggleCssAny(stylename, value);Toggles a style value with whatever style value was set before.
element: CSS element selector.
stylename: The name of a JS style.
value: Value of stylename.
example:
P('#a').toggleCssAny('color', 'green');
P(element);Select a HTML element.
element: CSS element selector.
example:
P('#a');
P(element).html(html);Replace inner HTML of an element.
element: CSS element selector.
html: Desired new HTML of element (can be HTML).
example:
P('#a').html('test');
P(element).css(css);Add CSS of an element.
element: CSS element selector.
css: Desired CSS in CSS text.
example:
P('#a').css('color:red; background:blue;');