
Security Fundamentals
Obfuscation 101: Unmasking the Tricks Behind Malicious Code
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
my-body-scroll-lock
Advanced tools
inspired by body-scroll-lock
English | 简体中文
tua-body-scroll-lock
enables body scroll locking for everything.
targetElement
targetElement
, even if it's not necessary😱Can't believe it? Please try this demo with BSL yourself.
$ npm i -S tua-body-scroll-lock
# OR
$ yarn add tua-body-scroll-lock
tua-bsl.umd.js
)
<!-- unpkg -->
<script src="https://unpkg.com/tua-body-scroll-lock"></script>
<!-- jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/tua-body-scroll-lock"></script>
tua-bsl.umd.min.js
)
<!-- unpkg -->
<script src="https://unpkg.com/tua-body-scroll-lock/dist/tua-bsl.umd.min.js"></script>
<!-- jsdelivr -->
<script src="https://cdn.jsdelivr.net/npm/tua-body-scroll-lock/dist/tua-bsl.umd.min.js"></script>
tua-bsl.esm.browser.js
)
<!-- unpkg -->
<script type="module">
import { lock, unlock } from 'https://unpkg.com/tua-body-scroll-lock/dist/tua-bsl.esm.browser.js'
lock()
unlock()
</script>
<!-- jsdelivr -->
<script type="module">
import { lock, unlock } from 'https://cdn.jsdelivr.net/npm/tua-body-scroll-lock/dist/tua-bsl.esm.browser.js'
lock()
unlock()
</script>
tua-bsl.esm.browser.min.js
)
<!-- unpkg -->
<script type="module">
import { lock, unlock } from 'https://unpkg.com/tua-body-scroll-lock/dist/tua-bsl.esm.browser.min.js'
lock()
unlock()
</script>
<!-- jsdelivr -->
<script type="module">
import { lock, unlock } from 'https://cdn.jsdelivr.net/npm/tua-body-scroll-lock/dist/tua-bsl.esm.browser.min.js'
lock()
unlock()
</script>
import { lock, unlock } from 'tua-body-scroll-lock'
lock()
unlock()
In some scenarios, when scrolling is prohibited, some elements still need to scroll, at this point, pass the targetElement.
import { lock, unlock } from 'tua-body-scroll-lock'
const elementOne = document.querySelector('#elementOne')
const elementTwo = document.querySelector('#elementTwo')
// one targetElement
const targetElement = elementOne
// multiple targetElements
const targetElements = [elementOne, elementTwo]
lock(targetElement)
lock(targetElements)
unlock(targetElement)
unlock(targetElements)
The
targetElement
is not required on the PC and Android.
In the SPA, if you called lock
, but forgot to call unlock
before jumping to other pages, that is too bad. Because the operation of the page is not restored, such as forbid touchmove
, clearBodyLocks
is used to clear all side effects. Sure, you can also call unlock
, but if you have called lock
multiple times, you must call unlock
multiple times, which is very unfriendly.
<template>
// some element
</template>
<script>
import { lock, unlock, clearBodyLocks } from 'tua-body-scroll-lock';
export default {
name: 'demo',
data () {
return {}
},
methods: {
showDialog () {
// Disable body scroll
lock()
},
hideDialog () {
// Enable body scroll
unlock()
}
},
beforeDestroy () {
// If forgot to call unlock before jumping to other pages, `clearBodyLocks` can clean all side effect.
clearBodyLocks()
}
}
</script>
platform | link |
---|---|
gh-pages | https://tuateam.github.io/tua-body-scroll-lock |
jsbin | https://jsbin.com/cafiful/edit?output |
codepen | https://codepen.io/buptsteve/pen/PvNQjP |
jsfiddle | https://jsfiddle.net/buptsteve/6u8g3Lf5/ |
codesandbox | https://codesandbox.io/s/o73z4jy5q9 |
Thanks goes to these wonderful people (emoji key):
evinma 💻 📖 🚇 🌍 | StEve Young 💻 📖 🚇 🌍 | li2go 💻 🐛 | songyan,Wang 💻 🐛 | Даниил Пронин 🐛 | 阿卡琳 🐛 | falstack 💻 |
This project follows the all-contributors specification. Contributions of any kind welcome!
FAQs
🔐Body scroll locking that just works with everything
The npm package my-body-scroll-lock receives a total of 0 weekly downloads. As such, my-body-scroll-lock popularity was classified as not popular.
We found that my-body-scroll-lock demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.