Skip to content

Commit 1f325a9

Browse files
committed
fix: get new wrapperInnerEl width on slides changes
1 parent c5c0ca3 commit 1f325a9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

projects/ng-slider/src/lib/slides/slides.component.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,13 @@ export class SlidesComponent implements OnInit, AfterViewInit, OnDestroy {
236236

237237
this.cdr.detectChanges();
238238

239-
this.slideWidthPercentage =
240-
((<HTMLElement>this.wrapperInnerEl.nativeElement.children[0])
241-
.getBoundingClientRect().width /
242-
this.wrapperInnerEl.nativeElement.getBoundingClientRect().width) *
243-
100;
239+
setTimeout(() => {
240+
this.slideWidthPercentage =
241+
((<HTMLElement>this.wrapperInnerEl.nativeElement.children[0])
242+
.getBoundingClientRect().width /
243+
this.wrapperInnerEl.nativeElement.getBoundingClientRect().width) *
244+
100;
245+
});
244246

245247
this.maxLeft =
246248
-this.slideWidthPercentage *

0 commit comments

Comments
 (0)