diff --git a/src/js/core/directives/ui-grid-render-container.js b/src/js/core/directives/ui-grid-render-container.js index c807274ef0..241515bec7 100644 --- a/src/js/core/directives/ui-grid-render-container.js +++ b/src/js/core/directives/ui-grid-render-container.js @@ -75,12 +75,10 @@ scrollTop = containerCtrl.viewport[0].scrollTop; - var scrollCount = scrollTop + scrollYAmount; // Get the scroll percentage - var scrollYPercentage = scrollCount / rowContainer.getVerticalScrollLength(); + var scrollYPercentage = (scrollTop + scrollYAmount) / rowContainer.getVerticalScrollLength(); // Keep scrollPercentage within the range 0-1. - if (scrollCount < 0 && rowContainer.getVerticalScrollLength() < 0) { scrollYPercentage = 0; } if (scrollYPercentage < 0) { scrollYPercentage = 0; } else if (scrollYPercentage > 1) { scrollYPercentage = 1; } @@ -101,7 +99,8 @@ } // Let the parent container scroll if the grid is already at the top/bottom - if ((event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || + if (rowContainer.getVerticalScrollLength() < 0 || + (event.deltaY !== 0 && (scrollEvent.atTop(scrollTop) || scrollEvent.atBottom(scrollTop))) || (event.deltaX !== 0 && (scrollEvent.atLeft(scrollLeft) || scrollEvent.atRight(scrollLeft)))) { //parent controller scrolls }