Skip to content

Commit

Permalink
Merged Alexander's patch again
Browse files Browse the repository at this point in the history
  • Loading branch information
asafdav committed May 14, 2014
1 parent 40c2158 commit 80287ab
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion dist/ng-scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ angular.module('ngScrollbar', []).directive('ngScrollbar', [
redraw();
};
var buildScrollbar = function (rollToBottom) {
var parentOffsetTop = element[0].parentElement.offsetTop;
var wheelEvent = win[0].onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';
rollToBottom = flags.bottom || rollToBottom;
mainElm = angular.element(element.children()[0]);
Expand All @@ -82,7 +83,7 @@ angular.module('ngScrollbar', []).directive('ngScrollbar', [
thumb = angular.element(angular.element(tools.children()[0]).children()[0]);
thumbLine = angular.element(thumb.children()[0]);
track = angular.element(angular.element(tools.children()[0]).children()[1]);
page.height = element[0].offsetHeight;
page.height = element[0].offsetHeight - parentOffsetTop;
page.scrollHeight = transculdedContainer[0].scrollHeight;
if (page.height < page.scrollHeight) {
scope.showYScrollbar = true;
Expand Down
4 changes: 2 additions & 2 deletions dist/ng-scrollbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion src/ng-scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ angular.module('ngScrollbar', []).

var buildScrollbar = function(rollToBottom) {

// Getting top position of a parent element to place scroll correctly
var parentOffsetTop = element[0].parentElement.offsetTop;

var wheelEvent = win[0].onmousewheel !== undefined ? 'mousewheel' : 'DOMMouseScroll';

rollToBottom = flags.bottom || rollToBottom;
Expand All @@ -123,7 +126,7 @@ angular.module('ngScrollbar', []).
track = angular.element(angular.element(tools.children()[0]).children()[1]);

// Check if scroll bar is needed
page.height = element[0].offsetHeight ;
page.height = element[0].offsetHeight - parentOffsetTop;
page.scrollHeight = transculdedContainer[0].scrollHeight;

if (page.height < page.scrollHeight) {
Expand Down

0 comments on commit 80287ab

Please sign in to comment.