Git Product home page Git Product logo

steps-js's Introduction

Steps JS

The fast, lightweight, easy-to-use, JavaScript Steps plugin.

How to use

To use this plugin add the following code to your page:

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

var steps = new Steps({
    steps: 'selector'
});

Call the steps actions whenever you need to move on another step:

button.addEventListener('click', function(event) {
    event.preventDefault();

    var moveToStep = this.getAttribute('data-move-to');

    if ( moveTo == 'next' ) {
        steps.next(); // To go to the next step
    } else if ( moveTo == 'prev' ) {
        steps.prev(); // To go to the previous step
    } else {
        steps.to(moveTo); // To go the a specific step, should be an index number
    }
});

Options

  • steps (string)

    • selector, used to link the steps. Default '[data-step]'.
  • activeClass (string)

    • class to be set on active step. Default 'active'.
  • customOrder (boolean)

    • If false, the steps will be ordered as per their original DOM order.

    • Set to true if the steps order is not the default DOM order, requires 'data-step-index="someIndex"' attribute for each step element. Example usage when step-4 is placed before step-2 in the DOM. Default false.

  • activeStep (integer)

    • the initially active step index. Default 0.
  • container (selector)

    • the parent selector for the steps (mainly used for multiple initializations). Default 'document'.

Methods

Use the following methods to wire up your functionality.

  • next()

    • sets the active class to the next step.
  • prev()

    • sets the active class to the previous step.
  • to(index)

    • sets the active class to specific step.
  • progress()

    • returns progress value - (activeStep / totalStepsLength - 1) * 100.

Examples

Use steps.html for example functionality.

steps-js's People

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.