Here’s how to add an intro to your site:
1) Download intro.js from https://github.com/usablica/intro.js/tags (which also contains lots of example usages)
2) Add the bootstrap-responsive.min.css and introjs.css files to the head of your page (see lines 6 and 7)
3) Add data-step and data-intro attributes to the sections of your page where you want the introduction to display (see lines 11, 12 and 13)
4) Add a button or link which starts the intro (see line 14)
5) Add the intro.js file to the bottom of your page (see line 16)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<head> | |
<link href="bootstrap.min.css" rel="stylesheet"> | |
<!-- Add IntroJs styles --> | |
<link href="bootstrap-responsive.min.css" rel="stylesheet"> | |
<link href="introjs.css" rel="stylesheet"> | |
<!-- end IntroJs styles --> | |
</head> | |
<body> | |
<h1 data-step="1" data-intro="Welcome to my demo, this is the title of my page">Demo for intro.js</h1> | |
<p data-step="2" data-intro="Here is some more text">This page shows how easy it is to add intro.js</p> | |
<p data-step="3" data-intro="I've also included an extra UX tip for devs">You can use cookies to detect if the user is new to your page</p> | |
<a class="btn btn-large btn-success" href="javascript:void(0);" onclick="javascript:introJs().start();">Start intro</a> | |
</body> | |
<script type="text/javascript" src="intro.js"></script> | |
</html> |
Here is an example runs the intro only the first time a user visits your page
http://stevenhollidge.com/blog-source-code/introjs/index-with-cookie.html
No comments:
Post a Comment