Skip to content

Commit

Permalink
Merge pull request #41 from od0/patch/pageheight
Browse files Browse the repository at this point in the history
Removing adjustment for parentOffsetTop which can cause issues with both the scollbar container size and the calculated scroll length
  • Loading branch information
asafdav committed Jun 19, 2015
2 parents a124f5c + 3a1ad43 commit 2bc478c
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/ng-scrollbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ angular.module('ngScrollbar', []).directive('ngScrollbar', [

var buildScrollbar = function (rollToBottom) {

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

rollToBottom = flags.bottom || rollToBottom;
mainElm = angular.element(element.children()[0]);
transculdedContainer = angular.element(mainElm.children()[0]);
Expand All @@ -172,11 +169,7 @@ angular.module('ngScrollbar', []).directive('ngScrollbar', [
thumbLine = angular.element(thumb.children()[0]);
track = angular.element(angular.element(tools.children()[0]).children()[1]);

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

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

0 comments on commit 2bc478c

Please sign in to comment.