From 859ae3b041674ea06b5a14c0d311198fad08e1aa Mon Sep 17 00:00:00 2001 From: Antek Date: Thu, 10 Jan 2019 11:11:26 +0100 Subject: [PATCH] Fix rounding error when using clientWidth --- src/lib/ngx-hm-carousel.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/ngx-hm-carousel.component.ts b/src/lib/ngx-hm-carousel.component.ts index 078ec98..3c8ab4f 100644 --- a/src/lib/ngx-hm-carousel.component.ts +++ b/src/lib/ngx-hm-carousel.component.ts @@ -277,7 +277,7 @@ export class NgxHmCarouselComponent implements ControlValueAccessor, AfterViewIn private hasInitWriteValue = false; private get rootElmWidth() { - return (isPlatformBrowser(this.platformId) ? this.rootElm.clientWidth : 100); + return (isPlatformBrowser(this.platformId) ? this.rootElm.getBoundingClientRect().width : 100); } private set containerElmWidth(value) {