From 79c3cc3d73560d1adf73f0ad5fe76545900b5de6 Mon Sep 17 00:00:00 2001 From: Marita Plafka Date: Thu, 2 Mar 2017 16:24:13 +0100 Subject: [PATCH] improve width calculation (autoWidth option true) --- src/js/lightslider.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/lightslider.js b/src/js/lightslider.js index 6d9c79f..ef01d7d 100644 --- a/src/js/lightslider.js +++ b/src/js/lightslider.js @@ -141,10 +141,10 @@ } else { w = 0; for (var i = 0; i < ln; i++) { - w += (parseInt($children.eq(i).width()) + settings.slideMargin); + w += ($children.eq(i)[0].getBoundingClientRect().width + settings.slideMargin); } } - return w; + return Math.ceil(w); }; plugin = { doCss: function () {