Noodles, Poodles and More!

    jquery.fn.scrollx

    1.0.13 • Public • Published

    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

    Install

    npm i jquery.fn.scrollx

    DownloadsWeekly Downloads

    16

    Version

    1.0.13

    License

    MIT

    Last publish

    Collaborators

    • kenberkeley