This repository was archived by the owner on Sep 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,9 @@ angular.module('material.core')
105
105
// Converts the body to a position fixed block and translate it to the proper scroll
106
106
// position
107
107
function disableBodyScroll ( ) {
108
- var restoreStyle = body . getAttribute ( 'style' ) || '' ;
108
+ var htmlNode = body . parentNode ;
109
+ var restoreHtmlStyle = htmlNode . getAttribute ( 'style' ) || '' ;
110
+ var restoreBodyStyle = body . getAttribute ( 'style' ) || '' ;
109
111
var scrollOffset = body . scrollTop + body . parentElement . scrollTop ;
110
112
var clientWidth = body . clientWidth ;
111
113
@@ -116,10 +118,15 @@ angular.module('material.core')
116
118
top : - scrollOffset + 'px'
117
119
} ) ;
118
120
121
+ applyStyles ( htmlNode , {
122
+ overflowY : 'hidden'
123
+ } ) ;
124
+
119
125
if ( body . clientWidth < clientWidth ) applyStyles ( body , { overflow : 'hidden' } ) ;
120
126
121
127
return function restoreScroll ( ) {
122
- body . setAttribute ( 'style' , restoreStyle ) ;
128
+ body . setAttribute ( 'style' , restoreBodyStyle ) ;
129
+ htmlNode . setAttribute ( 'style' , restoreHtmlStyle ) ;
123
130
body . scrollTop = scrollOffset ;
124
131
} ;
125
132
}
You can’t perform that action at this time.
0 commit comments