Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

All element becomes non-scrollable in IOS #274

Open
faikit opened this issue Dec 11, 2024 · 1 comment
Open

All element becomes non-scrollable in IOS #274

faikit opened this issue Dec 11, 2024 · 1 comment

Comments

@faikit
Copy link

faikit commented Dec 11, 2024

Hi, thanks for the wonderful project. I'm developing a website that has a sidebar. In the mobile platform, I want the sidebar to be scrollable but the background does not. By using this package, the target is achieved in Android etc, but not in IOS.

<!-- Header / Sidebar -->
<header>...</header>

<!-- Page -->
<div id="page">...</div>
...

<script>
    var sidebar_state = false;
    function changeSidebar() {
        if (sidebar_state === false) {
            bodyScrollLock.disableBodyScroll(document.getElementById("page"));
            sidebar_state = true;
        } else {
            bodyScrollLock.enableBodyScroll(document.getElementById("page"));
            sidebar_state = false;
        }
    }
</script>

The sidebar and page is at the same level, it works well in desktop for testing and Android, but not in IOS (iphone and ipad, work in mac). Here is the online webpage https://opendrivelab.com/challenge2025/.

@lreardon
Copy link

I encountered a similar issue recently. The solution in my case was that the element being passed to enableBodyScroll wasn't actually the precise element that I wanted to scroll, but rather a parent.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants