Simple Step By Step Site Tour Plugin - Intro.js
File Size: | 158 KB |
---|---|
Views Total: | 23239 |
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 website or application.
See also:
- jQuery Feature Tours Plugin - Joyride
- Crumble - Web Site Feature Tour Plugin
- Feature Walkthrough Plugin For jQuery and YUI - introtour-ui
- 10 Best Tour Plugins To Guide Visitors Through Your App
Install & Download
# NPM $ npm i intro.js
How to use it:
1. Include Intro.js and required CSS files on your web page
<!-- Core Stylesheet --> <link href="introjs.css" rel="stylesheet" /> <!-- For RTL --> <!-- <link href="introjs-rtl.css" rel="stylesheet"/> --> <!-- JavaScript --> <script 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.
/* Is this tour instance active? Don't show the tour again if this flag is set to false */ isActive: true, /* Next button label in tooltip box */ nextLabel: "Next", /* Previous button label in tooltip box */ prevLabel: "Back", /* Skip button label in tooltip box */ skipLabel: "×", /* 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 (note: this will also hide the "Done" button) */ hideNext: false, /* Change the Next button to Done in the last step of the intro? otherwise, it will render a disabled button */ nextToDone: true, /* Default tooltip box position */ tooltipPosition: "bottom", /* Next CSS class for tooltip boxes */ tooltipClass: "", /* Start intro for a group of elements */ group: "", /* 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, /* Display the pagination detail */ showStepNumbers: false, /* Pagination "of" label */ stepNumbersOfLabel: "of", /* 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.5, /* To determine the tooltip position automatically based on the window.width/height */ autoPosition: true, /* Precedence of positions, when auto is enabled */ positionPrecedence: ["bottom", "top", "right", "left"], /* Disable an interaction with element? */ disableInteraction: false, /* To display the "Don't show again" checkbox in the tour */ dontShowAgain: false, dontShowAgainLabel: "Don't show this again", /* "Don't show again" cookie name and expiry (in days) */ dontShowAgainCookie: "introjs-dontShowAgain", dontShowAgainCookieDays: 365, /* Set how much padding to be used around helper element */ helperElementPadding: 10, /* Default hint position */ hintPosition: "top-middle", /* Hint button label */ hintButtonLabel: "Got it", /* Display the "Got it" button? */ hintShowButton: true, /* Hints auto-refresh interval in ms (set to -1 to disable) */ hintAutoRefreshInterval: 10, /* Adding animation to hints? */ hintAnimation: true, /* additional classes to put on the buttons */ buttonClass: "introjs-button", /* additional classes to put on progress bar */ progressBarAdditionalClass: false,
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:
v7.2.0 (2023-08-15)
- Bugfix
v7.1.0 (2023-08-14)
- Refactoring the folder structure and improving types
- feat: adding typescript type declarations
- bugfixes
v7.0.1 (2023-03-26)
- Bug Fix
v7.0.0 (2023-03-26)
- Bug Fix
- Move to Typescript
v6.0.0 (2022-07-10)
- feat: async/await style callbacks and functions
- Correct position of skip button when having multiline titles
v5.1.0 (2022-04-05)
- feat: "Don't show again" feature
- feat: Adding pagination's "of" label to options
v5.0.0 (2022-02-07)
- fix: data attrs must be separated with a hyphen
- Adding ESM + minifying all assets by default
v4.3.0 (2021-11-07)
- Hint show/hide flag
- Hint CSS improvements
- Bug Fix
- fix: scroll top position for fixed elements
- fix:hint live refresh
v4.2.0 (2021-08-28)
- fix: scroll top position for fixed elements
v4.1.0 (2021-06-18)
- feat: updating the bullets layer after refresh(true)
- fix: exit() should not throw an exception if the parent elements are removed
v4.0.0 (2021-06-13)
- refactoring the introForElements function
v3.4.0 (2021-03-25)
- Fixing the overlay layer for position relative/sticky targets
- Fixesed: Positioning breaks when passing relatively-positioned element to introJs()
- Fix for setting left style checkRight.js
v3.3.1 (2021-02-07)
- Adding autoPosition option
v3.2.1 (2020-12-20)
- Bug Fix
v3.2.0 (2020-12-17)
- Bug Fix
v3.1.0 (2020-02-13)
- feat: adding title field to intro items
- fix(babel): updating the browser support
- feat: box-shadow background
- fix(intro): adding hasAttribute
2020-02-13
- Fixed calculating tooltip bottom position
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.