Skip to content

Commit 30ee8c0

Browse files
committed
adding option to remove hints animation
1 parent 8d417e5 commit 30ee8c0

File tree

2 files changed

+29
-4
lines changed

2 files changed

+29
-4
lines changed

intro.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@
7272
/* Default hint position */
7373
hintPosition: 'top-middle',
7474
/* Hint button label */
75-
hintButtonLabel: 'Got it'
75+
hintButtonLabel: 'Got it',
76+
/* Adding animation to hints? */
77+
hintAnimation: true
7678
};
7779
}
7880

@@ -1243,7 +1245,8 @@
12431245
currentItem.element = document.querySelector(currentItem.element);
12441246
}
12451247

1246-
currentItem.hintPosition = currentItem.hintPosition || 'top-middle';
1248+
currentItem.hintPosition = currentItem.hintPosition || this._options.hintPosition;
1249+
currentItem.hintAnimation = currentItem.hintAnimation || this._options.hintAnimation;
12471250

12481251
if (currentItem.element != null) {
12491252
this._introItems.push(currentItem);
@@ -1260,10 +1263,20 @@
12601263
for (var i = 0, l = hints.length; i < l; i++) {
12611264
var currentElement = hints[i];
12621265

1266+
// hint animation
1267+
var hintAnimation = currentElement.getAttribute('data-hintAnimation');
1268+
1269+
if (hintAnimation) {
1270+
hintAnimation = (hintAnimation == 'true');
1271+
} else {
1272+
hintAnimation = this._options.hintAnimation;
1273+
}
1274+
12631275
this._introItems.push({
12641276
element: currentElement,
12651277
hint: currentElement.getAttribute('data-hint'),
12661278
hintPosition: currentElement.getAttribute('data-hintPosition') || this._options.hintPosition,
1279+
hintAnimation: hintAnimation,
12671280
tooltipClass: currentElement.getAttribute('data-tooltipClass'),
12681281
position: currentElement.getAttribute('data-position') || this._options.tooltipPosition
12691282
});
@@ -1376,6 +1389,10 @@
13761389

13771390
hint.className = 'introjs-hint';
13781391

1392+
if (!item.hintAnimation) {
1393+
hint.className += ' introjs-hint-no-anim';
1394+
}
1395+
13791396
// hint's position should be fixed if the target element's position is fixed
13801397
if (_isFixed(item.element)) {
13811398
hint.className += ' introjs-fixedhint';

introjs.css

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,12 @@ tr.introjs-showElement > th {
357357
background: transparent;
358358
width: 20px;
359359
height: 15px;
360+
cursor: pointer;
361+
}
362+
.introjs-hint:focus {
363+
border: 0;
364+
outline: 0;
360365
}
361-
362366
.introjs-hidehint {
363367
display: none;
364368
}
@@ -387,7 +391,11 @@ tr.introjs-showElement > th {
387391
-o-transition: all 0.2s ease-out;
388392
transition: all 0.2s ease-out;
389393
}
390-
394+
.introjs-hint-no-anim .introjs-hint-dot {
395+
-webkit-animation: none;
396+
-moz-animation: none;
397+
animation: none;
398+
}
391399
.introjs-hint-dot {
392400
border: 10px solid rgba(146, 146, 146, 0.36);
393401
background: transparent;

0 commit comments

Comments
 (0)