Code Monkey home page Code Monkey logo

progress-bars-collection's Introduction

Progress Bars Collection (Single Element, HTML/CSS/JS)

A progress bar concept where we grab a <progress /> element and create a multi-element construction under the hood. This construction is easy to use and to style.

Check The Live Demo

image
image

How To Use

Styles

  • copy src/styles.css into your folder and add it into your HTML code like this:

      <link rel="stylesheet" href="src/style.css">
  • if you don't need all the file, you should copy all the CSS code from the file after:

    /* PROGRESS STYLES: YOU NEED THEM!!! */

    and before Example #1 styles marked like that:

    /* EXAMPLE #1 */

    and insert in your own styles file. Also copy styles of example you prefer or you could write your own;

HTML

  • add <progress /> into your code like this:
    <!-- there can be example 1-4 classname if you want predefined styles or your own classname or your own classname. -->
    <div class="example-1 progress-bars">
      <progress max="100" value="25" data-title="SEO">25%</progress>
      <progress max="100" value="50" data-title="Graphic Design">50%</progress>
      ... <!-- there could be as many bars as you need -->
    </div>
  • all the <progress /> attributes are crucial and you should add all of them;
  • progress-bars class name is crucial, keep it please;

Scripts

  • if you use Typescript, you should copy src/progress.ts to your code;
  • if you use JavaScript, you should copy code from src/scripts.js or import the whole file to your HTML:
    <html>
      <head></head>
      <body>
        <!-- all your HTML code -->
        <script type="module" src="/src/scripts.js"></script>
      </body>
    </html>
  • call the init function:
    setProgressBars({
      // here you should provide a parent progress bars container (it can be not only direct parent, but an ancestor any level above)
      parentSelector: ".your-parent-selector", //can be classname or id
      // optional parameter: a classname which will be applied to progress bar parent container for convenient theming
      // if you want to use predefined styles, you should use it like "example-1__progress" (1 - 4)
      className: "example-4__progress",
    });

Stack

  • HTML5
  • CSS3
  • JS (ES6+)
  • Vite

How to run locally

  • install dependencies
npm install
// or
yarn
  • start local server via Vite
npm start dev

// or

yarn dev

progress-bars-collection's People

Contributors

nat-davydova avatar

Stargazers

 avatar Charlie avatar

Watchers

 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.