Skip to content
This repository has been archived by the owner on Feb 17, 2021. It is now read-only.

Commit

Permalink
move onShow callback to invoke after bubble actually shows (in case o…
Browse files Browse the repository at this point in the history
…f windowScroll)
  • Loading branch information
Gordon Koo committed Apr 1, 2013
1 parent d117e95 commit e73c4e5
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 32 deletions.
24 changes: 13 additions & 11 deletions js/hopscotch-0.0.5.js
Expand Up @@ -1656,7 +1656,16 @@
cookieVal = currTour.id + ':' + stepNum,
bubble = getBubble(),
targetEl = utils.getStepTarget(step),
isLast;
isLast,
showBubble;

showBubble = function() {
bubble.show();
utils.invokeEventCallbacks('show');
if (step.onShow) {
utils.invokeCallback(step.onShow);
}
};

// Update bubble for current step
currStepNum = stepNum;
Expand All @@ -1668,26 +1677,19 @@

isLast = (stepNum === numTourSteps - 1);
bubble.render(step, stepNum, isLast, function(adjustScroll) {
// when done adjusting window scroll, call bubble.show()
// when done adjusting window scroll, call showBubble helper fn
if (adjustScroll) {
adjustWindowScroll(function() {
bubble.show();
});
adjustWindowScroll(showBubble);
}
else {
bubble.show();
}

if (step.onShow) {
utils.invokeCallback(step.onShow);
showBubble();
}

// If we want to advance to next step when user clicks on target.
if (step.nextOnTargetClick) {
utils.addClickListener(targetEl, targetClickNextFn);
}
});
utils.invokeEventCallbacks('show');

if (step.multipage) {
cookieVal += ':mp';
Expand Down

0 comments on commit e73c4e5

Please sign in to comment.