Skip to content

Commit 1d45e7f

Browse files
authored
Merge pull request #5488 from IgniteUI/mkirova/fix-4719-8.1.x
fix(igxFor): Ensure that when scrollHeight is same as container size …
2 parents 303652c + 64dd206 commit 1d45e7f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

projects/igniteui-angular/src/lib/directives/for-of/for_of.directive.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ export class IgxForOfDirective<T> implements OnInit, OnChanges, DoCheck, OnDestr
679679

680680
const containerSize = parseInt(this.igxForContainerSize, 10);
681681
const maxRealScrollTop = event.target.children[0].scrollHeight - containerSize;
682-
const realPercentScrolled = event.target.scrollTop / maxRealScrollTop;
682+
const realPercentScrolled = maxRealScrollTop !== 0 ? event.target.scrollTop / maxRealScrollTop : 0;
683683
if (!this._bScrollInternal) {
684684
const maxVirtScrollTop = this._virtHeight - containerSize;
685685
this._virtScrollTop = realPercentScrolled * maxVirtScrollTop;
@@ -1512,7 +1512,7 @@ export class IgxGridForOfDirective<T> extends IgxForOfDirective<T> implements On
15121512

15131513
const containerSize = parseInt(this.igxForContainerSize, 10);
15141514
const maxRealScrollTop = event.target.children[0].scrollHeight - containerSize;
1515-
const realPercentScrolled = event.target.scrollTop / maxRealScrollTop;
1515+
const realPercentScrolled = maxRealScrollTop !== 0 ? event.target.scrollTop / maxRealScrollTop : 0;
15161516
if (!this._bScrollInternal) {
15171517
const maxVirtScrollTop = this._virtHeight - containerSize;
15181518
this._virtScrollTop = realPercentScrolled * maxVirtScrollTop;

0 commit comments

Comments
 (0)