Skip to content

Commit 81c97c8

Browse files
committed
adding two new options to hide next and previous button in the first and last steps, closes usablica#58 + adding cursor pointer to the bullet points
1 parent 6169b7f commit 81c97c8

File tree

6 files changed

+76
-39
lines changed

6 files changed

+76
-39
lines changed

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "intro.js",
33
"repo": "usablica/intro.js",
44
"description": "Better introductions for websites and features with a step-by-step guide for your projects",
5-
"version": "2.2.0",
5+
"version": "2.3.0",
66
"main": "intro.js",
77
"scripts": [
88
"intro.js"

intro.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Intro.js v2.2.0
2+
* Intro.js v2.3.0
33
* https://github.com/usablica/intro.js
44
*
55
* Copyright (C) 2016 Afshin Mehrabani (@afshinmeh)
@@ -18,7 +18,7 @@
1818
}
1919
} (this, function (exports) {
2020
//Default config/variables
21-
var VERSION = '2.2.0';
21+
var VERSION = '2.3.0';
2222

2323
/**
2424
* IntroJs main class
@@ -38,6 +38,10 @@
3838
skipLabel: 'Skip',
3939
/* Done button label in tooltip box */
4040
doneLabel: 'Done',
41+
/* Hide previous button in the first step? Otherwise, it will be disabled button. */
42+
hidePrev: true,
43+
/* Hide next button in the last step? Otherwise, it will be disabled button. */
44+
hideNext: true,
4145
/* Default tooltip box position */
4246
tooltipPosition: 'bottom',
4347
/* Next CSS class for tooltip boxes */
@@ -1009,14 +1013,28 @@
10091013
nextTooltipButton.removeAttribute('tabIndex');
10101014

10111015
if (this._currentStep == 0 && this._introItems.length > 1) {
1012-
prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled';
1013-
prevTooltipButton.tabIndex = '-1';
10141016
nextTooltipButton.className = 'introjs-button introjs-nextbutton';
1017+
1018+
if (this._options.hidePrev == true) {
1019+
prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-hidden';
1020+
nextTooltipButton.className += ' introjs-fullbutton';
1021+
} else {
1022+
prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled';
1023+
}
1024+
1025+
prevTooltipButton.tabIndex = '-1';
10151026
skipTooltipButton.innerHTML = this._options.skipLabel;
10161027
} else if (this._introItems.length - 1 == this._currentStep || this._introItems.length == 1) {
10171028
skipTooltipButton.innerHTML = this._options.doneLabel;
10181029
prevTooltipButton.className = 'introjs-button introjs-prevbutton';
1019-
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
1030+
1031+
if (this._options.hideNext == true) {
1032+
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-hidden';
1033+
prevTooltipButton.className += ' introjs-fullbutton';
1034+
} else {
1035+
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
1036+
}
1037+
10201038
nextTooltipButton.tabIndex = '-1';
10211039
} else {
10221040
prevTooltipButton.className = 'introjs-button introjs-prevbutton';

introjs.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,12 +276,25 @@ tr.introjs-showElement > th {
276276
border-right: none;
277277
}
278278

279+
.introjs-prevbutton.introjs-fullbutton {
280+
border: 1px solid #d4d4d4;
281+
-webkit-border-radius: 0.2em;
282+
-moz-border-radius: 0.2em;
283+
border-radius: 0.2em;
284+
}
285+
279286
.introjs-nextbutton {
280287
-webkit-border-radius: 0 0.2em 0.2em 0;
281288
-moz-border-radius: 0 0.2em 0.2em 0;
282289
border-radius: 0 0.2em 0.2em 0;
283290
}
284291

292+
.introjs-nextbutton.introjs-fullbutton {
293+
-webkit-border-radius: 0.2em;
294+
-moz-border-radius: 0.2em;
295+
border-radius: 0.2em;
296+
}
297+
285298
.introjs-disabled, .introjs-disabled:hover, .introjs-disabled:focus {
286299
color: #9a9a9a;
287300
border-color: #d4d4d4;
@@ -292,6 +305,10 @@ tr.introjs-showElement > th {
292305
text-decoration: none;
293306
}
294307

308+
.introjs-hidden {
309+
display: none;
310+
}
311+
295312
.introjs-bullets {
296313
text-align: center;
297314
}
@@ -315,6 +332,7 @@ tr.introjs-showElement > th {
315332
-moz-border-radius: 10px;
316333
-webkit-border-radius: 10px;
317334
text-decoration: none;
335+
cursor: pointer;
318336
}
319337
.introjs-bullets ul li a:hover {
320338
background: #999;

0 commit comments

Comments
 (0)