Skip to content

Add scrollup / scrolldown / scrollleft / scrollright to jQuery.prototype (debounce integrated)

Notifications You must be signed in to change notification settings

OneWayTech/jquery.fn.scrollx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Add scrollup / scrolldown / scrollleft / scrollright to jQuery.prototype (debounce integrated)

npm version npm download JavaScript Style Guide

§ Demo

Demo (source code of demo)

§ Installation

⊙ npm

npm i -S jquery.fn.scrollx

⊙ CDN

<script src="//unpkg.com/jquery.fn.scrollx"></script>

§ Usage

import $ from 'jquery'
require('jquery.fn.scrollx')($)

const period = 200 // for debounce

const listener = (delta, currentOffset, lastOffset) => { ... }
let unlistener
const unlistenerReceiver = f => { unlistener = f }

$('#foo').scrollup(listener, period, unlistenerReceiver)
$('#bar').on('click', unlistener)

listener is required
period (defaults to 100 ms) and unlistenerReceiver are optional

e.g.

$('#foo').scrolldown(listener)
$('#foo').scrollleft(listener, 300)
$('#foo').scrollright(listener, unlistenerReceiver)

§ Reference

About

Add scrollup / scrolldown / scrollleft / scrollright to jQuery.prototype (debounce integrated)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published