From 32718ae9cc39b985533dedc2e8a95319294354c5 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 1 Apr 2014 11:44:45 +0300 Subject: [PATCH] As per jQuery docs the `innerWidth` method is the one that includes padding (https://api.jquery.com/innerWidth/), while the previously used `outerWidth` includes border width as well (https://api.jquery.com/outerWidth/). Therefore the use of `innerWidth` makes more sense for getting the container width with padding in the code (plus a setting name `includePadding` suggest only padding width is taken into account as an extra for container width determination and might be confusing otherwise). The same goes to `innerHeight` vs `outerHeight`. --- src/perfect-scrollbar.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/perfect-scrollbar.js b/src/perfect-scrollbar.js index 5a397d4..cc882dd 100644 --- a/src/perfect-scrollbar.js +++ b/src/perfect-scrollbar.js @@ -152,8 +152,8 @@ }; var updateBarSizeAndPosition = function () { - containerWidth = settings.includePadding ? $this.outerWidth() : $this.width(); - containerHeight = settings.includePadding ? $this.outerHeight() : $this.height(); + containerWidth = settings.includePadding ? $this.innerWidth() : $this.width(); + containerHeight = settings.includePadding ? $this.innerHeight() : $this.height(); contentWidth = $this.prop('scrollWidth'); contentHeight = $this.prop('scrollHeight');