Socket
Socket
Sign inDemoInstall

slick-scroll

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    slick-scroll

A slick scroller for HTML elements or window (Valina javascript)


Version published
Maintainers
1
Install size
12.3 kB
Created

Readme

Source

slick-scroll

Demos

Demos

Credit:

@shunryu111 http://stackoverflow.com/users/2630316/shunryu111

Based on:

http://stackoverflow.com/a/26798337/5068410

install

npm install slick-scroll --save

usage

import Scroller from 'slick-scroll';
// OR
const Scroller = require('slick-scroll');

// window
const windowScroller = new Scroller({
    speed: 1000
})

// Container
const container = document.getElementById('rolling');

const containerScroller = new Scroller({
    element: container,
    speed: 1000
})

myScroller.to(500).scroll()
myScroller.to(500).setSpeed(700).scroll()
myScroller.to(500).setEasing('easeOutSine').scroll();
myScroller.to(500).setSpeed(700).setEasing('easeInOutSine').scroll();

// Element in the DOM
myScroller.to(element).scroll()
myScroller.to(element).speed(700).scroll()
myScroller.to(element).easing('easeInOutQuint').scroll();
myScroller.to(element).speed(700).easing('easeInOutQuint').scroll();

// Save the scroller and use whenever you need
const scrollToTop = myScroller.to(0).speed(700).easing('easeInOutQuint');
scrollToTop.scroll()

const menu = document.getElementById('menu');
const scrollToMenu = myScroller.to(menu).speed(700).easing('easeOutSine');
scrollToMenu.scroll()

Options : object

Kind: global typedef Properties

NameTypeDefault
elementElementwindow
speednumber500
easingstring"'easeOutSine'"

Scroller

scroller.setSpeed(speed) ⇒ this

Sets the scroll speed

Kind: instance method of Scroller

ParamType
speednumber

scroller.setEasing(easing) ⇒ this

Sets the scroll easing function

Kind: instance method of Scroller

ParamType
easingstring

scroller.to(to) ⇒ this

Sets the scroll to

Kind: instance method of Scroller

ParamType
toElement | number

scroller.scroll([onSuccess], [onFailure])

Scroll

Kind: instance method of Scroller

ParamTypeDefaultDescription
[onSuccess]function() => {}callback function when finish to scroll
[onFailure]function() => {}callback function when failed to scroll

Scroller.Scroller

Kind: static class of Scroller

new Scroller(options)

Creates an instance of Scroller.

ParamType
optionsOptions

Keywords

FAQs

Last updated on 21 Sep 2017

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc