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

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Koo committed Nov 19, 2012
1 parent a2ba602 commit eb26699
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 41 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -98,7 +98,7 @@ <h3>Tour Options</h3>
<script src="bootstrap/js/bootstrap-tooltip.js""></script>
<script src="bootstrap/js/bootstrap-popover.js""></script>
-->
<script src="js/jquery-1.7.2.js"></script>
<!--<script src="js/jquery-1.7.2.js"></script>-->
<!--<script src="js/hopscotch_jquery.js"></script>-->
<script src="js/hopscotch-0.0.4.js"></script>
<script src="js/exampletour.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion js/exampletour.js
Expand Up @@ -85,7 +85,7 @@ var tour = {
showPrevButton: true,
scrollTopMargin: 50,
arrowWidth: 20,
//scrollDuration: 2000,
scrollDuration: 500,
cookieName: 'li_hs',
skipIfNoElement: true,
onNext: function(tourId, idx) {
Expand Down
18 changes: 11 additions & 7 deletions js/hopscotch-0.0.4.js
Expand Up @@ -1150,7 +1150,8 @@
yuiEase,
direction,
scrollIncr,
scrollInt;
scrollTimeout,
scrollTimeoutFn;

// Target and bubble are both visible in viewport
if (targetTop >= windowTop && (targetTop <= windowTop + opt.scrollTopMargin || targetBottom <= windowBottom)) {
Expand Down Expand Up @@ -1200,7 +1201,7 @@
// To increase or decrease duration, change the divisor of scrollIncr.
direction = (windowTop > targetTop) ? -1 : 1; // -1 means scrolling up, 1 means down
scrollIncr = Math.abs(windowTop - scrollToVal) / (opt.scrollDuration/10);
scrollInt = setInterval(function() {
scrollTimeoutFn = function() {
var scrollTop = utils.getScrollTop(),
scrollTarget = scrollTop + (direction * scrollIncr);

Expand All @@ -1209,7 +1210,6 @@
// Overshot our target. Just manually set to equal the target
// and clear the interval
scrollTarget = scrollToVal;
clearInterval(scrollInt);
if (cb) { cb(); } // HopscotchBubble.show
window.scrollTo(0, scrollTarget);
return;
Expand All @@ -1218,12 +1218,16 @@
window.scrollTo(0, scrollTarget);

if (utils.getScrollTop() === scrollTop) {
// Couldn't scroll any further. Clear interval.
clearInterval(scrollInt);

// Couldn't scroll any further.
if (cb) { cb(); } // HopscotchBubble.show
return;
}
}, 10);

// If we reached this point, that means there's still more to scroll.
setTimeout(scrollTimeoutFn, 10);
};

scrollTimeoutFn();
}
}
},
Expand Down
33 changes: 1 addition & 32 deletions js/hopscotch-0.0.4.min.js

Large diffs are not rendered by default.

0 comments on commit eb26699

Please sign in to comment.