Gathering detailed insights and metrics for v-body-scroll-lock
Gathering detailed insights and metrics for v-body-scroll-lock
Gathering detailed insights and metrics for v-body-scroll-lock
Gathering detailed insights and metrics for v-body-scroll-lock
A Vue directive to lock the body scroll without stopping the target element from scrolling.
npm install v-body-scroll-lock
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.3
Package Id
v-body-scroll-lock@1.1.3
Unpacked Size
387.05 kB
Size
138.83 kB
File Count
16
NPM Version
6.4.1
Node Version
8.12.0
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
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 v-body-scroll-lock="modalIsOpen" 3 v-show="modalIsOpen" 4 class="modal"> 5 <p>This is a modal! I am scrollable while the body is not!</p> 6 <button @click="closeModal">Close modal</button> 7 </div> 8</template>
1<script> 2export default { 3 name: 'modal', 4 data() { 5 return { 6 modalIsOpen: false, 7 } 8 }, 9 methods: { 10 closeModal() { 11 this.modalIsOpen = false; 12 }, 13 openModal() { 14 this.modalIsOpen = true; 15 } 16 } 17} 18</script>
Reserves the with 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