Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@sect/100vh
Advanced tools
Lightweight JS package for easy overcoming the problem with 100vh on mobile devices
Lightweight JS package for easy overcoming the problem with 100vh on mobile devices :iphone:
It creates the CSS variable called --vh
at the <html>
tag and vh
variable in the window
, which is changed on orientation change & resize
event and stays still during scroll. This will prevent the page "jumping" on scroll, which leads to bad user experience.
This will stay still only on mobile devices, on desktop the value changes together with the viewport. That means that it can be used on any resolution and there is no need for additional css media queries.
Install package in your project
npm i @sect/100vh
Import the package and run the init function at the page start.
(for Nuxt.js/Vue app it can be initialized in plugins, if you're using other technology – init the script above all the other code)
import vh from '@sect/100vh';
vh.init();
<!-- Include 100vh from dist -->
<script src="dist/100vh.umd.js"></script>
<!-- Initialize (you can do this whenever you want) -->
<script>
vh.init();
</script>
CSS
.section {
height: var(--vh);
}
JS
window.querySelectorAll('section').style.height = window.vh;
Want to help improve this plugin? Great!
Project is open-source so fork repo and join us!
MIT License © Sparing Interactive
FAQs
Lightweight JS package for easy overcoming the problem with 100vh on mobile devices
The npm package @sect/100vh receives a total of 10 weekly downloads. As such, @sect/100vh popularity was classified as not popular.
We found that @sect/100vh 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 News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.