{"id":21525810,"url":"https://github.com/bkwld/body-scroll-toggle","last_synced_at":"2025-04-09T23:23:05.093Z","repository":{"id":74790124,"uuid":"52397008","full_name":"BKWLD/body-scroll-toggle","owner":"BKWLD","description":"Enables / disables scroll on the body","archived":false,"fork":false,"pushed_at":"2019-11-08T03:15:13.000Z","size":25,"stargazers_count":19,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T01:12:31.914Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BKWLD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-02-23T22:42:27.000Z","updated_at":"2023-07-28T04:08:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"32c07c56-e725-420b-8ca7-094415cc090f","html_url":"https://github.com/BKWLD/body-scroll-toggle","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fbody-scroll-toggle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fbody-scroll-toggle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fbody-scroll-toggle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BKWLD%2Fbody-scroll-toggle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BKWLD","download_url":"https://codeload.github.com/BKWLD/body-scroll-toggle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248126774,"owners_count":21052032,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:38:31.783Z","updated_at":"2025-04-09T23:23:05.054Z","avatar_url":"https://github.com/BKWLD.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e I'm recommending you use https://github.com/willmcpo/body-scroll-lock rather than this package now.\n\n# Body scroll toggle\n\nDisables scroll-ability of the `body`, like you'd want when a fixed position modal is open, by logging the current scroll position and then making the body position fixed using that scroll offset of the body top.  Thus, the user shouldn't see the body shift position.  Many approaches just `overflow:hidden` on the body, but this does not disable scrolling in iOS.\n\n\n```js\nconst bodyScroll = require('body-scroll-toggle')\nbodyScroll.disable()\nbodyScroll.enable()\n```\n\nA disadvantage of this approach is that the iOS bottom nav bar will get re-displayed when the scroll is disabled.\n\n## Alternatives\n\nThere are JS `event.preventDefault()` based approaches like:\n\n- https://github.com/gilbarbara/disable-scroll\n- https://github.com/ultrapasty/jquery-disablescroll\n\nThese work but will prevent scrolling of internal elements that have an `overflow:scroll`, which is often the case in mobile navs.\n\n## Contributing\n\nRun `npm version \u003cnewversino\u003e \u0026\u0026 npm publish` to push new builds up.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fbody-scroll-toggle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkwld%2Fbody-scroll-toggle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkwld%2Fbody-scroll-toggle/lists"}