Skip to content

Commit c1bf5fe

Browse files
author
Yaron Nachshon
committed
support element or function
1 parent c30df7c commit c1bf5fe

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

intro.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,22 @@
294294
backdrop = null;
295295
}
296296

297+
function isFunction(value){
298+
return (typeof value) === 'function';
299+
}
300+
297301
function showStep(step){
298302
var _showStep = function(){
303+
var element;
299304
hint = hint || new Hint();
300305
backdrop = backdrop || createBackdrop();
301306

302-
hint.setTarget(step.element || $('body'));
307+
if(isFunction(step.element)){
308+
element = step.element();
309+
}else{
310+
element = step.element;
311+
}
312+
hint.setTarget(element || $('body'));
303313
hint.setPosition(step.hintPosition);
304314
hint.setTooltipPosition(step.tooltipPosition);
305315
hint.setContent(step.intro);

0 commit comments

Comments
 (0)