JSFiddle - React, Tailwind, and code Playground
HTML
<div id="wrapper" style="height:100%;">
<div id="innerWrapper" style="height:100%;">
<div id="div1"></div>
<div id="div2"></div>
</div>
</div>
CSS
html
{
overflow: scroll;
}
html, body
{
height: 100%;
margin: 0;
padding: 0;
}
.test {height:0;}
#div1 {
background-color: blue;
height: 500px;
}
#div2 {
background-color: yellow;
height: 500px;
}
JavaScript
var div = $("<div id='spacer'>");
div.css({
height: 200,
backgroundColor: "green"
});
// scroll down to see the green div, it's removed after 3 seconds
// but a white void remains in IE
$("#innerWrapper").append(div);
setTimeout(function () {
$("#spacer").detach();
$('html').css('overflow', 'auto');
}, 3000);