Skip to content

Commit 2a37987

Browse files
committed
add default hint position + remove unused functions
1 parent b1e5ef2 commit 2a37987

File tree

2 files changed

+3
-47
lines changed

2 files changed

+3
-47
lines changed

example/programmatic/hint.html

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ <h4>Section Six</h4>
9999
console.log('hint clicked', hintElement, item, stepId);
100100
});
101101

102-
intro.onhintremove(function (stepId) {
103-
console.log('hint removed', stepId);
104-
});
105-
106102
intro.onhintclose(function (stepId) {
107103
console.log('hint closed', stepId);
108104
});

intro.js

Lines changed: 3 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
/* Disable an interaction with element? */
6969
disableInteraction: false,
7070
/* Default hint position */
71-
hintPosition: 'top',
71+
hintPosition: 'top-middle',
7272
/* Hint button label */
7373
hintButtonLabel: 'Got it'
7474
};
@@ -1218,6 +1218,8 @@
12181218
currentItem.element = document.querySelector(currentItem.element);
12191219
}
12201220

1221+
currentItem.hintPosition = currentItem.hintPosition || 'top-middle';
1222+
12211223
if (currentItem.element != null) {
12221224
this._introItems.push(currentItem);
12231225
}
@@ -1269,26 +1271,6 @@
12691271
}
12701272
}
12711273

1272-
/**
1273-
* Remove single hint from the page
1274-
*
1275-
* @api private
1276-
* @method _removeHint
1277-
*/
1278-
function _removeHint(stepId) {
1279-
_removeHintTooltip.call(this);
1280-
var hint = this._targetElement.querySelector('.introjs-hint[data-step="' + stepId + '"]');
1281-
1282-
if (hint) {
1283-
hint.parentNode.removeChild(hint);
1284-
}
1285-
1286-
// call the callback function (if any)
1287-
if (typeof (this._hintRemoveCallback) !== 'undefined') {
1288-
this._hintRemoveCallback.call(this, stepId);
1289-
}
1290-
};
1291-
12921274
/**
12931275
* Hide a hint
12941276
*
@@ -1309,20 +1291,6 @@
13091291
}
13101292
};
13111293

1312-
/**
1313-
* Remove all hints from the page
1314-
*
1315-
* @api private
1316-
* @method _removeHints
1317-
*/
1318-
function _removeHints() {
1319-
var hints = this._targetElement.querySelectorAll('.introjs-hint');
1320-
1321-
for (var i = 0, l = hints.length; i < l; i++) {
1322-
_removeHint.call(this, hints[i].getAttribute('data-step'));
1323-
}
1324-
};
1325-
13261294
/**
13271295
* Add all available hints to the page
13281296
*
@@ -1698,14 +1666,6 @@
16981666
}
16991667
return this;
17001668
},
1701-
onhintremove: function(providedCallback) {
1702-
if (typeof (providedCallback) === 'function') {
1703-
this._hintRemoveCallback = providedCallback;
1704-
} else {
1705-
throw new Error('Provided callback for onhintremove was not a function.');
1706-
}
1707-
return this;
1708-
},
17091669
onexit: function(providedCallback) {
17101670
if (typeof (providedCallback) === 'function') {
17111671
this._introExitCallback = providedCallback;

0 commit comments

Comments
 (0)