npm i -S jquery.fn.scrollx
<script src="//unpkg.com/jquery.fn.scrollx"></script>
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)