Simple Step By Step Site Tour Plugin - Intro.js

Simple Step By Step Site Tour Plugin - Intro.js
File Size: 3.76 MB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

Intro.js is a simple and fast js library that makes it easier to create Step By Step website tour guide with keyboard and mouse support.

Good for introducing new features of your webisite or application.

See also:

How to use it:

1. Include Intro.js and required CSS files on your web page

<link href="introjs.css" rel="stylesheet">
<!--[if lte IE 8]>
    <link href="introjs-ie.css" rel="stylesheet">
<!-- <![endif]-->

<script type="text/javascript" src="intro.js"></script>

2. Include a theme CSS of your choice on the page. All possible themes:

  • Dark
  • Flattener
  • Modern
  • Nassim
  • Nazanin
  • Royal
<link href="themes/introjs-dark.css" rel="stylesheet">

3. Markup html structure. Simply using data-step, data-intro and data-position to create the site tour container. All possible data attributes:

  • data-intro: The tooltip text of step
  • data-step: the number (priority) of step
  • data-tooltipClass: the CSS class for tooltip
  • data-highlightClass: the CSS class for the helperLayer
  • data-position: top, left, right, bottom (default), bottom-left-aligned (same as bottom), bottom-middle-aligned, bottom-right-aligned or auto
  • data-scrollTo: the element to scroll to
  • data-disable-interaction: disable interactions with elements inside the highlighted box
<div data-step="1" data-intro="Content 1">Feature #1</div>
<div data-step="2" data-intro="Contetn 2" data-position='right'>Feature #2</div>
<div data-step="3" data-intro="Contetn 3" data-position='left'>Feature #3</div>

4. Create a link to trigger the site tour.

<a href="javascript:void(0);" onclick="javascript:introJs().start();">Show me how</a>

5. All possibile options.

// introJs().setOption(optionName, optionValue);

/* Next button label in tooltip box */
nextLabel: 'Next &rarr;',

/* Previous button label in tooltip box */
prevLabel: '&larr; Back',

/* Skip button label in tooltip box */
skipLabel: 'Skip',

/* Done button label in tooltip box */
doneLabel: 'Done',

/* Hide previous button in the first step? Otherwise, it will be disabled button. */
hidePrev: false,

/* Hide next button in the last step? Otherwise, it will be disabled button. */
hideNext: false,

/* Default tooltip box position */
tooltipPosition: 'bottom',

/* Next CSS class for tooltip boxes */
tooltipClass: '',

/* CSS class that is added to the helperLayer */
highlightClass: '',

/* Close introduction when pressing Escape button? */
exitOnEsc: true,

/* Close introduction when clicking on overlay layer? */
exitOnOverlayClick: true,

/* Show step numbers in introduction? */
showStepNumbers: true,

/* Let user use keyboard to navigate the tour? */
keyboardNavigation: true,

/* Show tour control buttons? */
showButtons: true,

/* Show tour bullets? */
showBullets: true,

/* Show tour progress? */
showProgress: false,

/* Scroll to highlighted element? */
scrollToElement: true,

/*
 * Should we scroll the tooltip or target element?
 *
 * Options are: 'element' or 'tooltip'
 */
scrollTo: 'element',

/* Padding to add after scrolling when element is not in the viewport (in pixels) */
scrollPadding: 30,

/* Set the overlay opacity */
overlayOpacity: 0.8,

/* Precedence of positions, when auto is enabled */
positionPrecedence: ["bottom", "top", "right", "left"],
/* Disable an interaction with element? */
disableInteraction: false,

/* Set how much padding to be used around helper element */
helperElementPadding: 10,

/* Default hint position */
hintPosition: 'top-middle',

/* Hint button label */
hintButtonLabel: 'Got it',

/* Adding animation to hints? */
hintAnimation: true,

/* additional classes to put on the buttons */
buttonClass: "introjs-button"

6. API methods available.

// start the intro
introJs.start()

// goto specific step
introJs.goToStep(step)

// goto specific step with the concrete step
introJs.goToStepNumber(step)

// add step
introJs.addStep(options)

// add steps
introJs.addSteps(steps)

// goto next step
introJs.nextStep()

// back to prev step
introJs.previousStep()

// exit the into
introJs.exit([force])

// set option(s)
introJs.setOption(option, value)
introJs.setOptions(options)

// refresh
introJs.refresh()

// event handlers
introJs.oncomplete(providedCallback)
introJs.onexit(providedCallback)
introJs.onbeforeexit(providedCallback)
introJs.onchange(providedCallback)
introJs.onbeforechange(providedCallback)
introJs.onafterchange(providedCallback)

7. If you want to add hints to the tours.

<a href='https://example.com/' 
   data-hint='Step one!'
   data-hintPosition='top-middle'></a>

8. Possible options for the hints.

{
  hint: 'text for the hint',
  element: element,
  hintPosition: 'top-middle',
  hintAnimation: true
}

9. API methods for the hints.

// set option(s)
introJs.setOption(option, value)
introJs.setOptions(options)

// refresh
introJs.refresh()

// add hints
introJs.addHints()

// show specified hint
introJs.showHint(hintId)

// show hints
introJs.showHints()

// hide specified hint
introJs.hideHint(stepId)

// show hint dialog
introJs.showHintDialog(stepId)

// hide all hints
introJs.hideHints()

// event handlers
introJs.onhintclick(providedCallback)
introJs.onhintsadded(providedCallback)
introJs.onhintclose(providedCallback)

Changelog:

v2.9.3 (2018-07-20)

  • hotfix to skipping and exiting the intro

This awesome jQuery plugin is developed by usablica. For more Advanced Usages, please check the demo page or visit the official website.