GithubHelp home page GithubHelp logo

pjt.js's Introduction


Pjt.js is a JavaScript library. Its current main function is converting raw CSS into js styles and toggling CSS.

How to Use

Method 1: Download

  1. Download the latest Pjt.js release.
  2. Link to your page
<script src="pjt.js"></script>

Method 2: No Download

  1. link the latest version of pjt.js to your page
<script src="https://rawgit.com/pjtsearch/Pjt.js/master/pjt.js"></script>

Functions

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;');

pjt.js's People

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.