Skip to content

Commit

Permalink
enforced coding style after pull-request manual merge
Browse files Browse the repository at this point in the history
  • Loading branch information
LostCrew committed Nov 16, 2013
1 parent 425b594 commit 6da5583
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 41 deletions.
26 changes: 14 additions & 12 deletions build/js/bootstrap-tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,21 +453,23 @@
};

Tour.prototype._scrollIntoView = function(element, callback) {
var scrollTop,
var $element, $window, offsetTop, scrollTop, windowHeight,
_this = this;
this._debug("Scroll into view element " + element);
if (element) {
scrollTop = Math.max(0, $(element).offset().top - ($(window).height() / 2));
this._debug("Scroll into view: animating scrollTop: " + scrollTop + " elementOffset: " + ($(element).offset().top) + " windowHeight: " + ($(window).height()));
return $("body").stop().animate({
scrollTop: Math.ceil(scrollTop)
}, function() {
_this._debug("Scroll into view: animation end elementOffset: " + ($(element).offset().top) + " windowHeight: " + ($(window).height()));
return callback();
});
} else {
if (!element) {
return callback();
}
$element = $(element);
$window = $(window);
offsetTop = $element.offset().top;
windowHeight = $window.height();
scrollTop = Math.max(0, offsetTop - (windowHeight / 2));
this._debug("Scroll into view. ScrollTop: " + scrollTop + ". Element offset: " + offsetTop + ". Window height: " + windowHeight + ".");
return $("body").stop().animate({
scrollTop: Math.ceil(scrollTop)
}, function() {
callback();
return _this._debug("Scroll into view. Animation end element offset: " + ($element.offset().top) + ". Window height: " + ($window.height()) + ".");
});
};

Tour.prototype._onResize = function(callback, timeout) {
Expand Down
Loading

0 comments on commit 6da5583

Please sign in to comment.