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.

This commit is contained in:
Andrew 2014-04-01 11:44:45 +03:00 committed by Andrey Nikitenko
parent 84360fb730
commit 32718ae9cc

View File

@ -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');