pretty-scroll

1.1.5 • Public • Published

Pretty Scroll

A library to make an element follow you as you scroll

Demos

Installation

via npm

npm install pretty-scroll --save

or yarn

yarn add pretty-scroll

Basic

<div class="js-container">
  <div class="main">
  </div>
  <div class="sub">
    <div class="js-pretty-scroll">
      <!-- contents here -->
    </div>
  </div>
</div>
new PrettyScroll('.js-sidebar', {
  container: '.js-container',
  breakpoint: 575, // stop running the js when the window size is smaller than 575px
  offsetTop: 20, // space between the sticky element and the top of the window
  offsetBottom: 20, // space between the sticky element and the bottom of the window
  condition: () => true // you can disable the sticky behavior by returning false, it will be executed when you scroll.
});

Readme

Keywords

none

Package Sidebar

Install

npm i pretty-scroll

Weekly Downloads

194

Version

1.1.5

License

appleple

Unpacked Size

125 kB

Total Files

42

Last publish

Collaborators

  • appleple