File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,24 @@ function init() {
141141 else if ( scrollHeight > windowHeight &&
142142 ( body . offsetHeight <= windowHeight ||
143143 html . offsetHeight <= windowHeight ) ) {
144- root . style . height = "auto" ;
144+
145+ // DOMChange (throttle): fix height
146+ var pending = false ;
147+ var refresh = function ( ) {
148+ if ( ! pending && html . scrollHeight != document . height ) {
149+ pending = true ; // add a new pending action
150+ setTimeout ( function ( ) {
151+ html . style . height = document . height + 'px' ;
152+ pending = false ;
153+ } , 500 ) ; // act rarely to stay fast
154+ }
155+ } ;
156+ html . style . height = 'auto' ;
157+ setTimeout ( refresh , 10 ) ;
158+ addEvent ( "DOMNodeInserted" , refresh ) ;
159+ addEvent ( "DOMNodeRemoved" , refresh ) ;
160+
161+ // clearfix
145162 if ( root . offsetHeight <= windowHeight ) {
146163 var underlay = document . createElement ( "div" ) ;
147164 underlay . style . clear = "both" ;
You can’t perform that action at this time.
0 commit comments