You would need JavaScript for that. You could try adding a css class to the element with document.queryselector('.your-element-class').classList.add('some-class')
that overrides position relative with something like this:
.some-class {
position: absolute;
top: 15%;
left: 15%;
z-index: XX; /* for example '2' or '99' if needed */
}
On closing the element, use classList.remove(...)
to remove the overriding CSS class, and your element will jump back into the regular HTML flow. Consider how to handle scrolling. You can prevent vertical scroll while the some-class is active by adding vertical-scroll-y: hidden;
or you could use position:fixed;
instead so the element doesn't move when scrolling the rest of the content.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…