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.4).

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. The largest index
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
dimmer boolean Set to false to prevent rest of components from dimming true

License MIT

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

tutorialjs's People

Contributors

adellahlou avatar bobeta avatar brainmaestro avatar dayyanobrien avatar mefarazath avatar ofarukcaki avatar takejaw6 avatar vinird avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tutorialjs's Issues

Check readme grammar

This is a new repository so we need lots of help. Feel free to check the readme.md grammar and make any correction you consider necessary. Any change to understand better what is this repo for.

Simple logo

We need to create a simple logo for Tutorialjs library

Sample project

We need to include a new directory (./example) with an example project.

This most include an admin template with several components, here some examples of templates: example 1, example 2, example 3.

Tutorialjs have to be implement into the template.

The example most be a static HTML with no dependencies in order to use it without web servers.

Detect the last popup

Detect the last popup. When the index equals to endIndex it should show a "finish" button instead of "next" button.

Enable turn off dimmer option

Currently there is no option to disable the dimmer. In case the user wan to use only the popups we need to add a boolean option that prevent the dimmer to show up.

Readme improvements

If you find a better way to explain how this library works feel free to make a pull request with your suggestion.

Gif example

We need to create a gif example that can shows to people how does tutorialjs works, it could be something like this: example but with a aspect ratio of 4:4 or similar. Also it will be nice to use and admin template to show the example, this could works.

We need a three steps tutorial example.

Remember, this is a alpha version, so any bug please let me know.

Imgs examples

Pienso que sería útil incluir imagenes de como se vería el proyecto terminado o que como se prentendía ver

Typescript definitions file

Would you be interested in having a definitions file for those that use typescript? I can implement it if you agree.

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.