From bad61cabe2cd5ea9648eea074232b541c09c9f32 Mon Sep 17 00:00:00 2001 From: Jacquelin Date: Tue, 19 May 2015 11:57:35 +0200 Subject: [PATCH] Fix scroll on top : add a check if the scroll count and vertical scroll length are negative (Mean no scroll) Update of fix scroll on top/bottom : add a check if vertical scroll length is negative, mean 'Let the parent container scroll --- src/js/core/directives/ui-grid-render-container.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/core/directives/ui-grid-render-container.js b/src/js/core/directives/ui-grid-render-container.js index b8ee5ed299..241515bec7 100644 --- a/src/js/core/directives/ui-grid-render-container.js +++ b/src/js/core/directives/ui-grid-render-container.js @@ -74,6 +74,7 @@ var scrollYAmount = event.deltaY * -1 * event.deltaFactor; scrollTop = containerCtrl.viewport[0].scrollTop; + // Get the scroll percentage var scrollYPercentage = (scrollTop + scrollYAmount) / rowContainer.getVerticalScrollLength(); @@ -98,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 }