Skip to content

Commit ed069c5

Browse files
committed
Redesign buttons + add previous button to tooltip buttons
1 parent 324c982 commit ed069c5

File tree

2 files changed

+85
-13
lines changed

2 files changed

+85
-13
lines changed

intro.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,27 +253,41 @@
253253
tooltipLayer.appendChild(arrowLayer);
254254
helperLayer.appendChild(tooltipLayer);
255255

256-
var skipTooltipButton = document.createElement("a");
257-
skipTooltipButton.className = "introjs-skipbutton";
258-
skipTooltipButton.href = "javascript:void(0);";
259-
skipTooltipButton.innerHTML = "Skip";
260-
256+
//next button
261257
var nextTooltipButton = document.createElement("a");
262258

263259
nextTooltipButton.onclick = function() {
264260
_nextStep.call(self);
265261
};
266262

267-
nextTooltipButton.className = "introjs-nextbutton";
263+
nextTooltipButton.className = "introjs-button introjs-nextbutton";
268264
nextTooltipButton.href = "javascript:void(0);";
269265
nextTooltipButton.innerHTML = "Next →";
270266

267+
//previous button
268+
var prevTooltipButton = document.createElement("a");
269+
270+
prevTooltipButton.onclick = function() {
271+
_previousStep.call(self);
272+
};
273+
274+
prevTooltipButton.className = "introjs-button introjs-prevbutton";
275+
prevTooltipButton.href = "javascript:void(0);";
276+
prevTooltipButton.innerHTML = "← Back";
277+
278+
//skip button
279+
var skipTooltipButton = document.createElement("a");
280+
skipTooltipButton.className = "introjs-button introjs-skipbutton";
281+
skipTooltipButton.href = "javascript:void(0);";
282+
skipTooltipButton.innerHTML = "Skip";
283+
271284
skipTooltipButton.onclick = function() {
272285
_exitIntro.call(self, self._targetElement);
273286
};
274287

275288
var tooltipButtonsLayer = tooltipLayer.querySelector('.introjs-tooltipbuttons');
276289
tooltipButtonsLayer.appendChild(skipTooltipButton);
290+
tooltipButtonsLayer.appendChild(prevTooltipButton);
277291
tooltipButtonsLayer.appendChild(nextTooltipButton);
278292

279293
//set proper position

introjs.css

Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,75 @@
111111
}
112112

113113
.introjs-tooltipbuttons {
114-
font-size: 10px;
115114
text-align: right;
116115
}
117116

118-
.introjs-tooltipbuttons .introjs-skipbutton {
117+
.introjs-button {
118+
position: relative;
119+
overflow: visible;
120+
display: inline-block;
121+
padding: 0.3em 0.8em;
122+
border: 1px solid #d4d4d4;
123+
margin: 0;
124+
text-decoration: none;
125+
text-shadow: 1px 1px 0 #fff;
126+
font: 11px/normal sans-serif;
127+
color: #333;
128+
white-space: nowrap;
129+
cursor: pointer;
130+
outline: none;
131+
background-color: #ececec;
132+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f4f4f4), to(#ececec));
133+
background-image: -moz-linear-gradient(#f4f4f4, #ececec);
134+
background-image: -o-linear-gradient(#f4f4f4, #ececec);
135+
background-image: linear-gradient(#f4f4f4, #ececec);
136+
-webkit-background-clip: padding;
137+
-moz-background-clip: padding;
138+
-o-background-clip: padding-box;
139+
/*background-clip: padding-box;*/ /* commented out due to Opera 11.10 bug */
140+
-webkit-border-radius: 0.2em;
141+
-moz-border-radius: 0.2em;
142+
border-radius: 0.2em;
143+
/* IE hacks */
144+
zoom: 1;
145+
*display: inline;
146+
margin-top: 10px;
147+
}
148+
149+
.introjs-button:hover {
150+
border-color: #bcbcbc;
151+
text-decoration: none;
152+
box-shadow: 0px 1px 1px #e3e3e3;
153+
}
154+
155+
.introjs-button:focus,
156+
.introjs-button:active {
157+
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ececec), to(#f4f4f4));
158+
background-image: -moz-linear-gradient(#ececec, #f4f4f4);
159+
background-image: -o-linear-gradient(#ececec, #f4f4f4);
160+
background-image: linear-gradient(#ececec, #f4f4f4);
161+
}
162+
163+
/* overrides extra padding on button elements in Firefox */
164+
.introjs-button::-moz-focus-inner {
165+
padding: 0;
166+
border: 0;
167+
}
168+
169+
.introjs-skipbutton {
119170
margin-right: 5px;
120-
color: gray;
171+
color: #7a7a7a;
121172
}
122173

123-
.introjs-tooltipbuttons .introjs-nextbutton {
124-
font-size: 11px;
125-
font-weight: bold;
126-
color: #2071d3;
174+
.introjs-prevbutton {
175+
-webkit-border-radius: 0.2em 0 0 0.2em;
176+
-moz-border-radius: 0.2em 0 0 0.2em;
177+
border-radius: 0.2em 0 0 0.2em;
178+
border-right: none;
179+
}
180+
181+
.introjs-nextbutton {
182+
-webkit-border-radius: 0 0.2em 0.2em 0;
183+
-moz-border-radius: 0 0.2em 0.2em 0;
184+
border-radius: 0 0.2em 0.2em 0;
127185
}

0 commit comments

Comments
 (0)