Giter Club home page Giter Club logo

tutorialjs's Introduction

Tutorialjs status alpha

Watch the gif

TutorialJS is a better way to introduce your application or new features of an existing application.

It shows new users a step-by-step guide on how to use the various components of your project.

This library is based on Semantic UI elements and uses Semantic UI popups.

How to contribute

*This project is in alpha version (0.1.0).

You can contribute following the contribution guidelines in CONTRIBUTING.md. Also check issues to start contributing to this project.

Dependencies

JQuery

The main dependency is JQuery, it also use Semantic UI styles and scripts but those are included in this repository.

How to use tutorialjs

Add Semantic UI CSS components

<link rel="stylesheet" href="./tutorialjs/semantic_components/popup.min.css">
<link rel="stylesheet" href="./tutorialjs/semantic_components/transition.min.css">

Add Semantic UI Scripts

<script src="./tutorialjs/semantic_components/transition.min.js"></script>
<script src="./tutorialjs/semantic_components/popup.min.js"></script>

Include Tutorialjs script

<script src="./tutorialjs/tutorial.js"></script>

Optional

If you want to use Semantic UI button styles you can add the following:

<link rel="stylesheet" href="./tutorialjs/semantic_components/button.min.css">

HTML

In order to link html tags with Tutorialjs you must add a tutorial class to each tag you want to have a step tutorial. Also, you need to include a custom property to define the index of the step; tutorial-index="index:int".

<div class="tutorial" tutorial-index="0">
  
</div>

By default the start index is 0.

To set a title and text to the popup you have to add two more custom attributes:

tutorial-title="title"

tutorial-text="text"

<div class="tutorial" tutorial-index="0" tutorial-title="My title" tutorial-text="My text">
  
</div>

The following is a tutorial with three index steps:

<div class="tutorial" tutorial-index="0" tutorial-title="My title" tutorial-text="My text">
</div>

<div class="tutorial" tutorial-index="1" tutorial-title="My title" tutorial-text="My text">
</div>

<div class="tutorial" tutorial-index="2" tutorial-title="My title" tutorial-text="My text">
</div>

Javascript

Once you have setup the HTML you are ready to run the tutorial. The simplest way to do it is using the start function of the Tutorial object, as follow:

Tutorial.start().then((success) => {
    console.warn(success)
}).catch((error) => {
    console.warn(error)
})

Tutorialjs runs the start function as a async promise so you must use then and catch to way for the response.

Success response:

Value
finished When the tutorial finish.
canceled When the tutorial is canceled.
outOfIndex When the tutorial meets endIndex option.
onlyOnce When the tutorial has runs and it has the onlyOnce option set to true.

Error response:

Value
Incorrect start index When the startIndex is not correct. Or tutorial-index="" is different than startIndex.

Options

The correct way to set options is to assign them before you trigger the start function, here an example:

Tutorial.startIndex = 0;
Tutorial.endIndex   = 4;

Tutorial.start().then((success) => {
    console.warn(success)
}).catch((error) => {
    console.warn(error)
})

Options available

Name Accepted values Description Default
startIndex int Start index point. 0
endIndex int End index point. 999
selector JQuery selector Selector, example: ".className" ".intro,.demo" "[href='default.htm']". ".tutorial"
onlyOnce true false It uses the current URL to determinate if the tutorial was already ran. And sets cookies to evaluate it next time it runs. false
styles true false Applies custom styles to the container of each step. true
bodyScroll true false If true it uses "body" tag to scroll otherwise it uses "html" tag. false
removeAnimationConflicts true false If true it overrides ".animated" class with CSS animation: unset. This helpful if you are using Animate.CSS. false
btnFramework "semantic" "bootstrap" "materialize" "custom" Set the CSS framework for styling the buttons. If you use "custom" you must set btnFinishClass and btnNextClass. "semantic"
btnFinishText string Set the text for the finish button. "Cancel"
btnFinishClass string Set the custom classes for the finish button. "ui button tiny basic"
btnNextText string Set the text for the next button. "Next"
btnNextClass string Set the custom classes for the next button. "ui button tiny primary

License MIT

The Tutorialjs library is an open-sourced software licensed under the MIT License.

tutorialjs's People

Contributors

vinird avatar brainmaestro avatar mefarazath avatar bobeta avatar dayyanobrien avatar ofarukcaki avatar

Stargazers

John F. Mandon 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.