Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions enjoyhint.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@
onEnd: function() {},

onSkip: function() {},

onNext: function() {}

onNext: function () { },

elementToScroll: document.body
};

var options = $.extend(defaults, _options);
Expand Down Expand Up @@ -62,7 +64,8 @@
options.onSkip();
skipAll();
},
fill: SHAPE_BACKGROUND_COLOR
fill: SHAPE_BACKGROUND_COLOR,
elementToScroll: options.elementToScroll
});
};

Expand Down Expand Up @@ -154,7 +157,7 @@
var isHintInViewport = $(step_data.selector).get(0).getBoundingClientRect();
if(isHintInViewport.top < 0 || isHintInViewport.bottom > (window.innerHeight || document.documentElement.clientHeight)){
hideCurrentHint();
$(document.body).scrollTo(step_data.selector, step_data.scrollAnimationSpeed || 250, {offset: -200});
$(options.elementToScroll).scrollTo(step_data.selector, step_data.scrollAnimationSpeed || 250, {offset: -200});
}
else {
// if previous button has been clicked and element are in viewport to prevent custom step scrollAnimationSpeed set scrollSpeed to default
Expand Down Expand Up @@ -186,6 +189,9 @@
if (step_data.showNext !== true) {
$body.enjoyhint("hide_next");
}
else {
$body.enjoyhint("show_next");
}

$body.enjoyhint("hide_prev");

Expand Down Expand Up @@ -1437,10 +1443,10 @@
else {
distance = initial_distance;
ver_button_position = initial_ver_position;
that.$next_btn.html(customBtnProps.nextButton && customBtnProps.nextButton.text ?
customBtnProps.nextButton.text : 'Next');
that.$prev_btn.html(customBtnProps.prevButton && customBtnProps.prevButton.text ?
customBtnProps.prevButton.text : 'Previous');
that.$next_btn.html(customBtnProps.nextButton && customBtnProps.nextButton.text ?
customBtnProps.nextButton.text : 'Next');
that.$prev_btn.html(customBtnProps.prevButton && customBtnProps.prevButton.text ?
customBtnProps.prevButton.text : 'Previous');
}

that.$prev_btn.css({
Expand Down
Loading