Home / Disable / Yootheme Consent – Scroll block
Duplicate Snippet

Embed Snippet on Your Site

Yootheme Consent – Scroll block

Reinhard Ekker
<10
Code Preview
css
/* When the consent banner is present, lock the viewport */
html:has(.tm-consent),
body:has(.tm-consent) {
    overflow: hidden !important;
    height: 100% !important;
    position: fixed; /* Extra insurance to lock mobile scrolling */
    width: 100%;
}
/* Your red overlay */
body:has(.tm-consent)::before {
    content: "";
    position: fixed; /* Changed from absolute to fixed */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgb(0 0 0 / 50%); /* Semi-transparent red for testing */
    z-index: 1000;
    pointer-events: all; /* If you want to block clicks to the background */
}
.tm-consent {
    z-index: 1001;
}

Comments

Add a Comment