2.0.2 • Published 4 years ago

ue-scroll-js v2.0.2

Weekly downloads
227
License
MIT
Repository
github
Last release
4 years ago

ue-scroll.js

Lightweight JavaScript library for scroll up.

Demo and documentation: https://azrsix.github.io/ue-scroll-js/

Getting Started

Install by npm (recommended)

$ npm install ue-scroll-js --save

or Yarn

$ yarn add ue-scroll-js

Using CDN

<link rel="stylesheet" href="//unpkg.com/ue-scroll-js@latest/dist/ue-scroll.min.css">
<script src="https://unpkg.com/ue-scroll-js"></script>

Basic Usage

<html>
  <head>
    <!-- Read CSS and JS -->
    <link rel="stylesheet" href="/path/to/ue-scroll-js/dist/ue-scroll.min.css">
    <script src="/path/to/ue-scroll-js/dist/ue-scroll.min.js"></script>
  </head>
  <body>
    <main>
      Your main contents
    </main>
    <!-- Run this script -->
    <div id="ue-scroll" class="ue-scroll btn-white arrow-black circle shadow"></div>
    <script>
      UeScroll.init();
    </script>
  </body>
</html>

or Set initial options

<!-- Run this script -->
<div id="my-custom-id" class="ue-scroll btn-white arrow-black circle shadow"></div>
<script>
  UeScroll.init({
    element: '#my-custom-id',
    scrollSpeed: 10
  });
</script>

Use on ES6 modules

'use strict';
import ue from 'ue-scroll-js';
// Run this script
ue.init();

By the default, ue-scroll.js automatically detect element having '#ue-scroll'. It needs to be started after DOM is rendered.

Options

KeyData TypeDefault ValueDescription
elementString'#ue-scroll'Specify an element with a CSS selector.
positionNumber200Specify the scroll position where the button is displayed.
scrollSpeedNumber10Specify the speed of scrolling (Recommend 20 or less)
fadeSpeedNumber10Specify the speed of fade (Recommend 20 or less)
cancelByScrollBooleantrueCancel scrolling when scroll down (This setting is ignored on touch devices)
cancelByClickBooleantrueCancel scrolling when window clicking.
cancelByKeydownBooleantrueCancel scrolling when pressed any key.

In addition, You can freely change the color, design, position etc of buttons with CSS!

Examples

Please refer to the documentation.

2.0.2

4 years ago

2.0.1

5 years ago

2.0.0

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago