Skip to content

Commit

Permalink
fix: get new wrapperInnerEl width on slides changes
Browse files Browse the repository at this point in the history
  • Loading branch information
makiJS committed May 20, 2020
1 parent c5c0ca3 commit 1f325a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions projects/ng-slider/src/lib/slides/slides.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,11 +236,13 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {

this.cdr.detectChanges();

this.slideWidthPercentage =
((<HTMLElement>this.wrapperInnerEl.nativeElement.children[0])
.getBoundingClientRect().width /
this.wrapperInnerEl.nativeElement.getBoundingClientRect().width) *
100;
setTimeout(() => {
this.slideWidthPercentage =
((<HTMLElement>this.wrapperInnerEl.nativeElement.children[0])
.getBoundingClientRect().width /
this.wrapperInnerEl.nativeElement.getBoundingClientRect().width) *
100;
});

this.maxLeft =
-this.slideWidthPercentage *
Expand Down

0 comments on commit 1f325a9

Please sign in to comment.