NaN Producing Misery

    viewport-events

    1.0.2 • Public • Published

    Viewport events Code Climate

    Enable viewport events for HTML elements: enteredView, leftView.

    Usage

    $ npm install viewport-events

        var vpEvents = require('viewport-events');
     
        //enable viewport events for all elements on the page
        vpEvents.enable();
        $('.my-element').on('leftView', function(){});
        $('.my-other-element').on('enteredView', function(){});
     
        //Disable all viewport events
        vpEvents.disable();
     
     
        //Enable viewport events for a Node/NodeList
        vpEvents.enable(element);
        element.addEventListener('enteredView', function(){});
        element.addEventListener('leftView', function(){});
     
        //Disable viewport events for the previously added element/selector
        vpEvents.disable(element);

    API

    vp.enable(selector)

    Enable viewport events for an Element, NodeList or selector. If no selector specified, '*' is used.

    vp.disable(selector)

    Disable viewport events for previously registered selector. If no selector specified, all viewport events are unbound.

    vp.enteredViewCallbackName

    Callback name used for entering viewport event. enteredView is used by default.

    vp.leftViewCallbackName

    Callback name used for leaving viewport event. leftView is used by default.

    NPM

    Install

    npm i viewport-events

    DownloadsWeekly Downloads

    5

    Version

    1.0.2

    License

    unlicense

    Last publish

    Collaborators

    • dfcreative
    • everyonesdesign