Gathering detailed insights and metrics for @chazy/v-body-scroll-lock--fix
Gathering detailed insights and metrics for @chazy/v-body-scroll-lock--fix
Gathering detailed insights and metrics for @chazy/v-body-scroll-lock--fix
Gathering detailed insights and metrics for @chazy/v-body-scroll-lock--fix
A Vue directive to lock the body scroll without stopping the target element from scrolling.
npm install @chazy/v-body-scroll-lock--fix
Typescript
Module System
Node Version
NPM Version
Vue (48.56%)
JavaScript (39.32%)
HTML (12.12%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
30 Stars
37 Commits
10 Forks
22 Branches
6 Contributors
Updated on Mar 20, 2024
Latest Version
1.1.6
Package Id
@chazy/v-body-scroll-lock--fix@1.1.6
Unpacked Size
6.47 kB
Size
2.60 kB
File Count
9
NPM Version
6.11.3
Node Version
12.11.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
A Vue directive to lock the body from scrolling without stopping the target element from scrolling.
Uses the body-scroll-lock library (https://github.com/willmcpo/body-scroll-lock).
Works on mobile and tablet (iOS, Android) and desktop (Chrome, Firefox, Safari).
yarn add v-body-scroll-lock
npm i v-body-scroll-lock --save
In your main JS file first import this plugin
import VBodyScrollLock from 'v-body-scroll-lock'
Install the plugin
Vue.use(VBodyScrollLock)
Add v-body-scroll-lock
or v-bsl
(short version) to the element which you want to keep scrollable.
v-body-scroll-lock
and v-bsl
take a boolean
as an argument like v-body-scroll-lock="modalIsOpen"
If modalIsOpen
is true, body scroll lock will be applied to other elements except for the one which has v-body-scroll-lock="modalIsOpen"
For a more deep example checkout App.vue
in /src/App.vue
.
1<template> 2 <div 3 v-body-scroll-lock="modalIsOpen" 4 v-show="modalIsOpen" 5 class="modal" 6 > 7 <p>This is a modal! I am scrollable while the body is not!</p> 8 <button @click="closeModal">Close modal</button> 9 </div> 10</template>
1<script> 2export default { 3 name: 'modal', 4 data() { 5 return { 6 modalIsOpen: false, 7 } 8 }, 9 methods: { 10 closeModal() { 11 this.$set(this, 'modalIsOpen', false) 12 }, 13 openModal() { 14 this.$set(this, 'modalIsOpen', true) 15 } 16 } 17} 18</script>
Reserves the width of the scrollbar and prevents the unpleasant flickering effect that can occur when locking the body scroll.
More info here.
To enable the reserveScrollBarGap
option add :reserveScrollBarGap
after v-body-scroll-lock
or v-bsl
.
Example: v-body-scroll-lock:reserveScrollBarGap="modalIsOpen"
.
Issues can be created on the issues page.
To contribute, please make a pull request.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 6/7 approved changesets -- score normalized to 8
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
118 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More