Skip to content

Commit 8f43883

Browse files
authored
Merge pull request usablica#649 from nblackburn/show-hints
Show hints
2 parents e54375c + a9c95a3 commit 8f43883

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

intro.js

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,6 +1365,38 @@
13651365
}
13661366
};
13671367

1368+
/**
1369+
* Show all hints
1370+
*
1371+
* @api private
1372+
* @method _showHints
1373+
*/
1374+
function _showHints() {
1375+
var hints = this._targetElement.querySelectorAll('.introjs-hint');
1376+
1377+
if (hints && hints.length > 0) {
1378+
for (var i = 0; i < hints.length; i++) {
1379+
_showHint.call(this, hints[i].getAttribute('data-step'));
1380+
}
1381+
} else {
1382+
_populateHints.call(this, this._targetElement);
1383+
}
1384+
};
1385+
1386+
/**
1387+
* Show a hint
1388+
*
1389+
* @api private
1390+
* @method _showHint
1391+
*/
1392+
function _showHint(stepId) {
1393+
var hint = this._targetElement.querySelector('.introjs-hint[data-step="' + stepId + '"]');
1394+
1395+
if (hint) {
1396+
hint.className = hint.className.replace(/introjs\-hidehint/g, '');
1397+
}
1398+
};
1399+
13681400
/**
13691401
* Add all available hints to the page
13701402
*
@@ -1767,6 +1799,14 @@
17671799
hideHints: function () {
17681800
_hideHints.call(this);
17691801
return this;
1802+
},
1803+
showHint: function (stepId) {
1804+
_showHint.call(this, stepId);
1805+
return this;
1806+
},
1807+
showHints: function () {
1808+
_showHints.call(this);
1809+
return this;
17701810
}
17711811
};
17721812

0 commit comments

Comments
 (0)