
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
Sticky-js is a library for sticky elements written in vanilla javascript. With this library you can easily set sticky elements on your website. It's also responsive.
npm install sticky-js
bower install sticky.js
Simply include
<script src="sticky.min.js"></script>
Then have element
<div class="selector">Sticky element</div>
Initialize in javascript
var sticky = new Sticky('.selector');
Syntax
new Sticky([selector:string], [global options:object])
CommonJS
var Sticky = require('sticky-js');
var sticky = new Sticky('.selector');
Multiple sticky elements with data-sticky-container and options
<div class="row" data-sticky-container>
<div class="medium-2 columns">
<img src="http://placehold.it/250x250" class="sticky" data-margin-top="20" data-sticky-for="1023" data-sticky-class="is-sticky">
</div>
<div class="medium-8 columns">
<h1>Sticky-js</h1>
<p>Lorem ipsum.....</p>
</div>
<div class="medium-2 columns">
<img src="http://placehold.it/250x250" class="sticky" data-margin-top="20" data-sticky-for="1023" data-sticky-class="is-sticky">
</div>
</div>
<script src="sticky.min.js"></script>
<script>
var sticky = new Sticky('.sticky');
</script>
Update sticky, e.g. when parent container (data-sticky-container) change height
var sticky = new Sticky('.sticky');
// and when parent change height..
sticky.update();
Destroy sticky element
var sticky = new Sticky('.sticky');
sticky.destroy();
| Option | Type | Default | Description |
|---|---|---|---|
| data-sticky-wrap | boolean | false | When it's true sticky element is wrapped in <span></span> which has sticky element dimensions. Prevents content from "jumping". |
| data-margin-top | number | 0 | Margin between page and sticky element when scrolled |
| data-sticky-for | number | 0 | Breakpoint which when is bigger than viewport width, sticky is activated and when is smaller, then sticky is destroyed |
| data-sticky-class | string | null | Class added to sticky element when it is stuck |
Clone this repository and run
npm start
Library is using ECMAScript 5 features.
If you need this library working with older browsers you should use ECMAScript 5 polyfill.
https://rgalus.github.io/sticky-js/
FAQs
Sticky elements
The npm package sticky-js receives a total of 10,774 weekly downloads. As such, sticky-js popularity was classified as popular.
We found that sticky-js 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.