All Projects → callmecavs → Jump.js

callmecavs / Jump.js

Licence: mit
A modern smooth scrolling library.

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Jump.js

Horizontal Scroll
Horizontal scroll with inertia
Stars: ✭ 175 (-94.94%)
Mutual labels:  scroll, scrolling, smooth
Moveto
A lightweight scroll animation javascript library without any dependency
Stars: ✭ 2,746 (-20.61%)
Mutual labels:  scroll, scrolling, smooth
react-scroll-trigger
📜 React component that monitors scroll events to trigger callbacks when it enters, exits and progresses through the viewport. All callback include the progress and velocity of the scrolling, in the event you want to manipulate stuff based on those values.
Stars: ✭ 126 (-96.36%)
Mutual labels:  scrolling, scroll
onscroll-effect
A tiny JavaScript library to enable CSS animations when user scrolls.
Stars: ✭ 35 (-98.99%)
Mutual labels:  scrolling, scroll
really-smooth-scroll
A script that smoothen scrolling in the browser
Stars: ✭ 21 (-99.39%)
Mutual labels:  scrolling, scroll
react-is-scrolling
Simply detect if users are scrolling in your components in a declarative API
Stars: ✭ 17 (-99.51%)
Mutual labels:  scrolling, scroll
scroll-sync-react
A scroll syncing library for react that is up to date
Stars: ✭ 49 (-98.58%)
Mutual labels:  scrolling, scroll
react-smart-scroll
Efficient rendering of long lists in React
Stars: ✭ 27 (-99.22%)
Mutual labels:  scrolling, scroll
React Indiana Drag Scroll
React component which implements scrolling via holding the mouse button or touch
Stars: ✭ 190 (-94.51%)
Mutual labels:  scroll, scrolling
Ngx Scroll To
Scroll to any element to enhance scroll-based features in you app. Works for Angular 4+, both AoT and SSR. No dependencies.
Stars: ✭ 269 (-92.22%)
Mutual labels:  scroll, scrolling
use-scroll-direction
A simple, performant, and cross-browser hook for detecting scroll direction in your next react app.
Stars: ✭ 24 (-99.31%)
Mutual labels:  scrolling, scroll
volx-recyclerview-fast-scroll
An easy to use implementation for fast scroll recyclerview
Stars: ✭ 34 (-99.02%)
Mutual labels:  scrolling, scroll
V Bar
The virtual responsive crossbrowser scrollbar component for VueJS 2x
Stars: ✭ 216 (-93.76%)
Mutual labels:  scroll, scrolling
universalSmoothScroll
A cross-browser smooth-scrolling API which supports multiple and interruptable scroll-animations on all DOM's elements, even at the same time!
Stars: ✭ 46 (-98.67%)
Mutual labels:  scroll, smooth
Stickyfill
Polyfill for CSS `position: sticky`
Stars: ✭ 2,252 (-34.89%)
Mutual labels:  scroll, scrolling
NoobScroll
A lightweight jQuery Plugin that add some cool function to make scrolling more fun [Archive]
Stars: ✭ 43 (-98.76%)
Mutual labels:  scrolling, scroll
srraf
Monitor scrolling and resizing without event listeners.
Stars: ✭ 26 (-99.25%)
Mutual labels:  scrolling, scroll
Infinitescroll
Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Stars: ✭ 183 (-94.71%)
Mutual labels:  scroll, scrolling
Scroll Snap
↯ Snap page when user stops scrolling, with a customizable configuration and a consistent cross browser behaviour
Stars: ✭ 187 (-94.59%)
Mutual labels:  scroll, scrolling
EasyScrollDots
Single page scroll JavaScript plugin that allows for vertical navigation of page sections
Stars: ✭ 38 (-98.9%)
Mutual labels:  scrolling, scroll

Jump.js

Jump.js on NPM Jump.js Downloads on NPM Standard JavaScript Style

A modern smooth scrolling library.

Usage

Jump was developed with a modern JavaScript workflow in mind. To use it, it's recommended you have a build system in place that can transpile ES6, and bundle modules. For a minimal boilerplate that fulfills those requirements, check out outset.

Follow these steps to get started:

  1. Install
  2. Import
  3. Call
  4. Review Options

Install

Using NPM, install Jump, and save it to your package.json dependencies.

$ npm install jump.js --save

Import

Import Jump, naming it according to your preference.

// import Jump

import jump from 'jump.js'

Call

Jump exports a singleton, so there's no need to create an instance. Just call it, passing a target.

// call Jump, passing a target

jump('.target')

Note that the singleton can make an infinite number of jumps.

Options

All options, except target, are optional, and have sensible defaults. The defaults are shown below:

jump('.target', {
  duration: 1000,
  offset: 0,
  callback: undefined,
  easing: easeInOutQuad,
  a11y: false
})

Explanation of each option follows:

target

Scroll from the current position by passing a number of pixels.

// scroll down 100px

jump(100)

// scroll up 100px

jump(-100)

Or, scroll to an element, by passing either:

  • a node, or
  • a CSS selector
// passing a node

const node = document.querySelector('.target')

jump(node)

// passing a CSS selector
// the element referenced by the selector is determined using document.querySelector

jump('.target')

duration

Pass the time the jump() takes, in milliseconds.

jump('.target', {
  duration: 1000
})

Or, pass a function that returns the duration of the jump() in milliseconds. This function is passed the jump() distance, in px, as a parameter.

jump('.target', {
  duration: distance => Math.abs(distance)
})

offset

Offset a jump(), only if to an element, by a number of pixels.

// stop 10px before the top of the element

jump('.target', {
  offset: -10
})

// stop 10px after the top of the element

jump('.target', {
  offset: 10
})

Note that this option is useful for accommodating position: fixed elements.

callback

Pass a function that will be called after the jump() has been completed.

// in both regular and arrow functions, this === window

jump('.target', {
  callback: () => console.log('Jump completed!')
})

easing

Easing function used to transition the jump().

jump('.target', {
  easing: easeInOutQuad
})

See easing.js for the definition of easeInOutQuad, the default easing function. Credit for this function goes to Robert Penner.

a11y

If enabled, and scrolling to an element:

jump('.target', {
  a11y: true
})

Note that this option is disabled by default because it has visual implications in many browsers. Focusing an element triggers the :focus CSS state selector, and is often accompanied by an outline.

Browser Support

Jump depends on the following browser APIs:

Consequently, it supports the following natively:

  • Chrome 24+
  • Firefox 23+
  • Safari 6.1+
  • Opera 15+
  • IE 10+
  • iOS Safari 7.1+
  • Android Browser 4.4+

To add support for older browsers, consider including polyfills/shims for the APIs listed above. There are no plans to include any in the library, in the interest of file size.

License

MIT. © 2017 Michael Cavalea

Built With Love

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].