Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 33b6f31

Browse files
committed
Added buttonClass to options - can now override class on the buttons.
1 parent 4c364c9 commit 33b6f31

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

intro.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@
7777
/* Hint button label */
7878
hintButtonLabel: 'Got it',
7979
/* Adding animation to hints? */
80-
hintAnimation: true
80+
hintAnimation: true,
81+
/* additional classes to put on the buttons */
82+
buttonClass: "introjs-button"
8183
};
8284
}
8385

@@ -1015,7 +1017,7 @@
10151017

10161018
//skip button
10171019
var skipTooltipButton = document.createElement('a');
1018-
skipTooltipButton.className = 'introjs-button introjs-skipbutton';
1020+
skipTooltipButton.className = this._options.buttonClass + ' introjs-skipbutton ';
10191021
_setAnchorAsButton(skipTooltipButton);
10201022
skipTooltipButton.innerHTML = this._options.skipLabel;
10211023

@@ -1058,22 +1060,22 @@
10581060
// when it's the first step of tour
10591061
if (this._currentStep == 0 && this._introItems.length > 1) {
10601062
if (typeof skipTooltipButton !== "undefined" && skipTooltipButton != null) {
1061-
skipTooltipButton.className = 'introjs-button introjs-skipbutton';
1063+
skipTooltipButton.className = this._options.buttonClass + ' introjs-skipbutton';
10621064
}
10631065
if (typeof nextTooltipButton !== "undefined" && nextTooltipButton != null) {
1064-
nextTooltipButton.className = 'introjs-button introjs-nextbutton';
1066+
nextTooltipButton.className = this._options.buttonClass + ' introjs-nextbutton';
10651067
}
10661068

10671069
if (this._options.hidePrev == true) {
10681070
if (typeof prevTooltipButton !== "undefined" && prevTooltipButton != null) {
1069-
prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-hidden';
1071+
prevTooltipButton.className = this._options.buttonClass + ' introjs-prevbutton introjs-hidden';
10701072
}
10711073
if (typeof nextTooltipButton !== "undefined" && nextTooltipButton != null) {
10721074
nextTooltipButton.className += ' introjs-fullbutton';
10731075
}
10741076
} else {
10751077
if (typeof prevTooltipButton !== "undefined" && prevTooltipButton != null) {
1076-
prevTooltipButton.className = 'introjs-button introjs-prevbutton introjs-disabled';
1078+
prevTooltipButton.className = this._options.buttonClass + ' introjs-prevbutton introjs-disabled';
10771079
}
10781080
}
10791081

@@ -1091,19 +1093,19 @@
10911093
skipTooltipButton.className += ' introjs-donebutton';
10921094
}
10931095
if (typeof prevTooltipButton !== "undefined" && prevTooltipButton != null) {
1094-
prevTooltipButton.className = 'introjs-button introjs-prevbutton';
1096+
prevTooltipButton.className = this._options.buttonClass + ' introjs-prevbutton';
10951097
}
10961098

10971099
if (this._options.hideNext == true) {
10981100
if (typeof nextTooltipButton !== "undefined" && nextTooltipButton != null) {
1099-
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-hidden';
1101+
nextTooltipButton.className = this._options.buttonClass + ' introjs-nextbutton introjs-hidden';
11001102
}
11011103
if (typeof prevTooltipButton !== "undefined" && prevTooltipButton != null) {
11021104
prevTooltipButton.className += ' introjs-fullbutton';
11031105
}
11041106
} else {
11051107
if (typeof nextTooltipButton !== "undefined" && nextTooltipButton != null) {
1106-
nextTooltipButton.className = 'introjs-button introjs-nextbutton introjs-disabled';
1108+
nextTooltipButton.className = this._options.buttonClass + ' introjs-nextbutton introjs-disabled';
11071109
}
11081110
}
11091111

@@ -1113,13 +1115,13 @@
11131115
} else {
11141116
// steps between start and end
11151117
if (typeof skipTooltipButton !== "undefined" && skipTooltipButton != null) {
1116-
skipTooltipButton.className = 'introjs-button introjs-skipbutton';
1118+
skipTooltipButton.className = this._options.buttonClass + ' introjs-skipbutton';
11171119
}
11181120
if (typeof prevTooltipButton !== "undefined" && prevTooltipButton != null) {
1119-
prevTooltipButton.className = 'introjs-button introjs-prevbutton';
1121+
prevTooltipButton.className = this._options.buttonClass + ' introjs-prevbutton';
11201122
}
11211123
if (typeof nextTooltipButton !== "undefined" && nextTooltipButton != null) {
1122-
nextTooltipButton.className = 'introjs-button introjs-nextbutton';
1124+
nextTooltipButton.className = this._options.buttonClass + ' introjs-nextbutton';
11231125
}
11241126
if (typeof skipTooltipButton !== "undefined" && skipTooltipButton != null) {
11251127
skipTooltipButton.innerHTML = this._options.skipLabel;
@@ -1757,7 +1759,7 @@
17571759
tooltipWrapper.innerHTML = item.hint;
17581760

17591761
var closeButton = document.createElement('a');
1760-
closeButton.className = 'introjs-button';
1762+
closeButton.className = this._options.buttonClass;
17611763
closeButton.innerHTML = this._options.hintButtonLabel;
17621764
closeButton.onclick = _hideHint.bind(this, stepId);
17631765

0 commit comments

Comments
 (0)