Here's my HTML, CSS and JS. What I'd like to achieve is that when you click on the div it would show the element that's positioned absolutely to the parent div, however overflowing the parent, so it'd be outside of the div with class modalChildren and div with class container. Right now it is rendered just under the parent and looks like a normal child element to the parent instead of overflowing.
const clickMe = document.querySelector('#clickMe')
clickMe.addEventListener('click', () => {
document.querySelector('.absoluteDiv').classList.toggle('hidden')
})
body {
margin: 0;
}
.wrapper {
display: flex;
align-items: center;
justify-content: center;
width: 100vw;
height: 100vh;
background: gray;
}
.container {
background: white;
display: flex;
flex-direction: column;
border-radius: 5px;
max-height: calc(100vh - 64px);
background: white;
padding: 16px;
min-width: 200px;
}
h1 {
margin: 0;
}
.buttonWrapper {
align-self: flex-end;
}
.modalChildren {
display: flex;
flex-direction: column;
overflow: auto;
}
#clickMe {
position: relative;
}
.hidden {
display: none;
}
.absoluteDiv {
position: absolute;
bottom: 0;
left: 0;
transform: translateY(100%);
width: 60px;
height: 300px;
background: red;
}
<div class="wrapper">
<div class="container">
<h1>
echo
</h1>
<div class="modalChildren">
echo <br />
echo <br />
echo <br />
echo <br />
echo <br />
echo <br />
echo <br />
echo <br />
echo <br />
<div id="clickMe">
<span>
click me
</span>
<div class="absoluteDiv hidden">
</div>
</div>
</div>
<div class="buttonWrapper">
<button>
1
</button>
<button>
2
</button>
</div>
</div>
</div>