From 7fe482cf9a632fcaade2d5827ac9bfd658eb90a3 Mon Sep 17 00:00:00 2001 From: Ryan Schmukler Date: Thu, 25 Jun 2015 11:12:40 -0400 Subject: [PATCH] fix(disableScroll): fix disable scroll creating scrollbar when none existed --- src/core/util/util.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core/util/util.js b/src/core/util/util.js index d72a12eaf82..ffcb74541fa 100644 --- a/src/core/util/util.js +++ b/src/core/util/util.js @@ -113,12 +113,14 @@ angular.module('material.core') var scrollOffset = body.scrollTop + body.parentElement.scrollTop; var clientWidth = body.clientWidth; - applyStyles(body, { - position: 'fixed', - width: '100%', - overflowY: 'scroll', - top: -scrollOffset + 'px' - }); + if (body.scrollHeight > body.clientHeight) { + applyStyles(body, { + position: 'fixed', + width: '100%', + overflowY: 'scroll', + top: -scrollOffset + 'px' + }); + } applyStyles(htmlNode, { overflowY: 'hidden'