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

Skip to content

Commit e76c373

Browse files
committed
feat: adding hintShowButton option + updating the hint animation
1 parent 35a3b26 commit e76c373

File tree

3 files changed

+35
-47
lines changed

3 files changed

+35
-47
lines changed

src/core/hint.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -315,15 +315,16 @@ export function showHintDialog(stepId) {
315315

316316
const tooltipWrapper = createElement("p");
317317
tooltipWrapper.innerHTML = item.hint;
318-
319-
const closeButton = createElement("a");
320-
closeButton.className = this._options.buttonClass;
321-
closeButton.setAttribute("role", "button");
322-
closeButton.innerHTML = this._options.hintButtonLabel;
323-
closeButton.onclick = hideHint.bind(this, stepId);
324-
325318
tooltipTextLayer.appendChild(tooltipWrapper);
326-
tooltipTextLayer.appendChild(closeButton);
319+
320+
if (this._options.hintShowButton) {
321+
const closeButton = createElement("a");
322+
closeButton.className = this._options.buttonClass;
323+
closeButton.setAttribute("role", "button");
324+
closeButton.innerHTML = this._options.hintButtonLabel;
325+
closeButton.onclick = hideHint.bind(this, stepId);
326+
tooltipTextLayer.appendChild(closeButton);
327+
}
327328

328329
arrowLayer.className = "introjs-arrow";
329330
tooltipLayer.appendChild(arrowLayer);

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ function IntroJs(obj) {
9292
hintPosition: "top-middle",
9393
/* Hint button label */
9494
hintButtonLabel: "Got it",
95+
/* Display the "Got it" button? */
96+
hintShowButton: true,
9597
/* Adding animation to hints? */
9698
hintAnimation: true,
9799
/* additional classes to put on the buttons */

src/styles/introjs.scss

Lines changed: 24 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,6 @@ $font_family: "Helvetica Neue", Inter, ui-sans-serif, "Apple Color Emoji",
1313
$background_color_9: #08c;
1414
$background_color_10: rgba(136, 136, 136, 0.24);
1515

16-
/*
17-
Buttons style by http://nicolasgallagher.com/lab/css3-github-buttons/
18-
Changed by Afshin Mehrabani
19-
*/
20-
/* overrides extra padding on button elements in Firefox */
21-
22-
@keyframes introjspulse {
23-
0% {
24-
transform: scale(0);
25-
opacity: 0;
26-
}
27-
25% {
28-
transform: scale(0);
29-
opacity: 0.1;
30-
}
31-
50% {
32-
transform: scale(0.1);
33-
opacity: 0.3;
34-
}
35-
75% {
36-
transform: scale(0.5);
37-
opacity: 0.5;
38-
}
39-
100% {
40-
transform: scale(1);
41-
opacity: 0;
42-
}
43-
}
44-
4516
.introjs-overlay {
4617
position: absolute;
4718
box-sizing: content-box;
@@ -439,7 +410,7 @@ tr.introjs-showElement {
439410

440411
&:hover {
441412
> .introjs-hint-pulse {
442-
border: 5px solid rgba(60, 60, 60, 0.57);
413+
background-color: rgba(60, 60, 60, 0.57);
443414
}
444415
}
445416
}
@@ -452,36 +423,50 @@ tr.introjs-showElement {
452423
position: fixed;
453424
}
454425

426+
@keyframes introjspulse {
427+
0% {
428+
transform: scale(0.95);
429+
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0.7);
430+
}
431+
432+
70% {
433+
transform: scale(1);
434+
box-shadow: 0 0 0 10px rgba(0, 0, 0, 0);
435+
}
436+
437+
100% {
438+
transform: scale(0.95);
439+
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
440+
}
441+
}
442+
455443
.introjs-hint-pulse {
456444
box-sizing: content-box;
457-
width: 10px;
458-
height: 10px;
459-
border: 5px solid rgba(60, 60, 60, 0.27);
445+
width: 15px;
446+
height: 15px;
460447
border-radius: 30px;
461448
background-color: $background_color_10;
462449
z-index: 10;
463450
position: absolute;
464451
transition: all 0.2s ease-out;
452+
animation: introjspulse 2s infinite;
465453
}
466454

467455
.introjs-hint-no-anim {
468-
.introjs-hint-dot {
456+
.introjs-hint-pulse {
469457
animation: none;
470458
}
471459
}
472460

473461
.introjs-hint-dot {
474462
box-sizing: content-box;
475-
border: 10px solid rgba(146, 146, 146, 0.36);
476463
background: transparent;
477464
border-radius: 60px;
478465
height: 50px;
479466
width: 50px;
480-
animation: introjspulse 3s ease-out;
481-
animation-iteration-count: infinite;
482467
position: absolute;
483-
top: -25px;
484-
left: -25px;
468+
top: -18px;
469+
left: -18px;
485470
z-index: 1;
486471
opacity: 0;
487472
}

0 commit comments

Comments
 (0)