How to disable scroll when tablet & mobile nav is open

Dear forum!
This is the site im working on: https://malche.webflow.io/

When i switch to tablet or mobile i use a standard dropdown menu

However when i scroll down from there this happens:

Can you help me out?
Thanks and Regards!


Here is my site Read-Only: LINK
(how to share your site Read-Only link)

Hi @johnthreesixteen,
I’ll answer your question on german. If you do need the answer in english, I’ll rewrite it.

Also… das ist überhaupt kein Problem. Ich persönlich habe es gelöst indem ich eine Classe zu dem Body hinzufüge with overflow hidden aber ich habe eine einfachere Lösung gefunden.

<!-- Disable Scroll Script -->
<script>
var Webflow = Webflow || [];
Webflow.push(function () {
    var $body = $(document.body);
    var scrollPosition = 0;

    $('[scroll="both"]').on('click', function () {
        if ($body.css('overflow') !== 'hidden') {
            var oldWidth = $body.innerWidth();
            scrollPosition = window.pageYOffset;
            $body.css('overflow', 'hidden');
            $body.css('position', 'fixed');
            $body.css('top', `-${scrollPosition}px`);
            $body.width(oldWidth);
        } else {
            $body.css('overflow', '');
            $body.css('position', '');
            $body.css('top', '');
            $body.width('');
            $(window).scrollTop(scrollPosition);
        }
    });
});
</script>

Kopiere einfach das Script und füge es in deinen Body ein. Dann füge ein custom Attribute zu deinem Menü Bürger Button hinzu mit “scroll=both”. Das sollte es dann auch schon gewesen sein.

Bei Problemen gerne melden.

Maxi

Hallo Maxi!
Danke für deine Antwort =)
Das funktioniert, nur jetzt gibt es ein neues Problem:
Wenn ich ein Dropdown in der mobile Navi öffne, dann kann ich leider auch nicht mehr runterscrollen.

Gibt es evtl. eine andere Lösung?
Danke und LG