Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(menu): prevents scrollbar from unnecessarily showing up on the body
Browse files Browse the repository at this point in the history
Closes #3266
  • Loading branch information
Robert Messerle committed Jun 15, 2015
1 parent 43c273e commit 5c08d5c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ angular.module('material.core')
function disableBodyScroll() {
var restoreStyle = body.getAttribute('style') || '';
var scrollOffset = body.scrollTop + body.parentElement.scrollTop;
var clientWidth = body.clientWidth;

applyStyles(body, {
position: 'fixed',
Expand All @@ -115,6 +116,8 @@ angular.module('material.core')
top: -scrollOffset + 'px'
});

if (body.clientWidth < clientWidth) applyStyles(body, { overflow: 'auto' });

return function restoreScroll() {
body.setAttribute('style', restoreStyle);
body.scrollTop = scrollOffset;
Expand Down

0 comments on commit 5c08d5c

Please sign in to comment.