2.0.0 • Published 1 year ago

scroll-master v2.0.0

Weekly downloads
105
License
MIT
Repository
github
Last release
1 year ago

Demo

Website: https://scrollmaster.robbie.digital

Code: https://github.com/Robbie-Cook/scroll-master/tree/master/packages/test

Install

npm i scroll-master

A better position: sticky

N.B. Forked from https://github.com/rgalus/sticky-js.

ES6 / CommonJS

import ScrollMaster from "scroll-master";

or

const { default: ScrollMaster } = require("scroll-master");

then, you can call scroll master to keep your item in view

new ScrollMaster('.selector');

HTML

<script src="https://unpkg.com/scroll-master@latest/dist/index.js">

then

<script>
ScrollMaster.default('selector');
</script>

Options

OptionTypeDefaultDescription
data-sticky-wrapbooleanfalseWhen it's true sticky element is wrapped in <span></span> which has sticky element dimensions. Prevents content from "jumping".
data-margin-topnumber0Margin between page and sticky element when scrolled
data-sticky-fornumber0Breakpoint which when is bigger than viewport width, sticky is activated and when is smaller, then sticky is destroyed
data-sticky-classstring"stuck"Class added to sticky element when it is stuck
data-custom-stylesbooleanfalseWhether to remove default styles for sticky element (and only apply classname)
2.0.0

1 year ago

1.0.2

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.4.4

3 years ago

0.2.3

3 years ago

0.4.0

3 years ago

0.4.2

3 years ago

0.3.1

3 years ago

0.3.0

4 years ago

0.2.2

4 years ago

0.2.1

4 years ago

0.1.0

4 years ago

0.2.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago

0.0.0

4 years ago