|
|
@@ -238,12 +238,13 @@ function getContentRect(el, origin) {
|
|
|
// NOTE: should use clientLeft/clientTop, but very unreliable cross-browser.
|
|
|
function getScrollbarWidths(el) {
|
|
|
var leftRightWidth = el.innerWidth() - el[0].clientWidth; // the paddings cancel out, leaving the scrollbars
|
|
|
- var widths = {
|
|
|
- left: 0,
|
|
|
- right: 0,
|
|
|
- top: 0,
|
|
|
- bottom: el.innerHeight() - el[0].clientHeight // the paddings cancel out, leaving the bottom scrollbar
|
|
|
- };
|
|
|
+ var bottomWidth = el.innerHeight() - el[0].clientHeight; // "
|
|
|
+ var widths;
|
|
|
+
|
|
|
+ leftRightWidth = sanitizeScrollbarWidth(leftRightWidth);
|
|
|
+ bottomWidth = sanitizeScrollbarWidth(bottomWidth);
|
|
|
+
|
|
|
+ widths = { left: 0, right: 0, top: 0, bottom: bottomWidth };
|
|
|
|
|
|
if (getIsLeftRtlScrollbars() && el.css('direction') == 'rtl') { // is the scrollbar on the left side?
|
|
|
widths.left = leftRightWidth;
|
|
|
@@ -256,6 +257,15 @@ function getScrollbarWidths(el) {
|
|
|
}
|
|
|
|
|
|
|
|
|
+// The scrollbar width computations in getScrollbarWidths are sometimes flawed when it comes to
|
|
|
+// retina displays, rounding, and IE11. Massage them into a usable value.
|
|
|
+function sanitizeScrollbarWidth(width) {
|
|
|
+ width = Math.max(0, width); // no negatives
|
|
|
+ width = Math.round(width);
|
|
|
+ return width;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
// Logic for determining if, when the element is right-to-left, the scrollbar appears on the left side
|
|
|
|
|
|
var _isLeftRtlScrollbars = null;
|