Intro.js page Guide simple usage sharing _javascript tips

Source: Internet
Author: User

Intro.js Demo http://usablica.github.io/intro.js/

The first step: introduce Intro.js and introjs.css to the page

Step Two: Select the block you want to add a guide to, and add a unique ID or style to the block

The third step: write a specific JS function, complete the boot function

Copy Code code as follows:

<script src= "@url. Content (" ~/content/intro.js ")" Type= "Text/javascript" ></script>
<link href= "@url. Content (" ~/content/introjs.css ")" rel= "stylesheet" type= "Text/css"/> "
<script type= "Text/javascript" >
$ (function () {
Intro ();
});
Called every time the page is loaded
function Intro () {
This variable can be used to access the version number, change the corresponding value when the system is updated
Cur_val = 1;
Determine the length of a variable that the function receives
if (Arguments.length ==0)
{
Each page sets a different cookie variable name, cannot be duplicated, when there is a new version, update Cur_val
Here to simulate a lot of web sites have a new version of the update only appear once a guide page, the second entry no longer appear, here is a cookie to judge
if ($.cookie ("intro_cookie_index") = = Cur_val)
{
Return
}
}

Introjs (). SetOptions ({
The corresponding button
Prevlabel: "The Last Step",
Nextlabel: "Next",
Skiplabel: "Skip",
Donelabel: "End",
The corresponding array, in the order that each step prompts the boot
Steps: [
{
The first step is to guide
This property is similar to the jquery selector, and you can use the jquery selector to select the object you want to select to guide
element: "#div1",
Here is the concrete text content of each boot frame, the middle can write HTML code
Intro: "This is the first div~~",
Here you can specify where the Guide box appears relative to the selected object Top,bottom,left,right
Position: "Right"
},
{
The second step is to guide
element: "#div2",
Intro: "This is the second div~~",
Position: "Left"
},
{
Step three Guide
Element: ". Div3",
Intro: "<a href=" www.cnblogs.com "> This is the third div</a>~~",
Position: "Bottom"
}
]

}). OnComplete (function () {
Click the event to execute after the Skip button (save the corresponding version number to the cookie and set the expiration date to 30 days)
$.cookie ("Intro_cookie_index", cur_val,{expires:30});
}). OnExit (function () {
After clicking the End button, the event executed
$.cookie ("Intro_cookie_index", cur_val,{expires:30});
). Start ();
}
</script>
<body>
<div id= "Div1" > here appears the first step to guide </div>
<div id= "Div2" > here appears the second step guide </div>
<div class= "Div3" > here appears the third step guide </div>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.