Reference Guide
Reference Guides / JavaScript API / Events / RegisterOnViewerScroll
In This Topic
    RegisterOnViewerScroll
    In This Topic
     RegisterOnViewerScroll

    This function allows you to trigger a function of your own when the viewer has been scrolled.

    RegisterOnViewerScroll: function (docuViewareID, callback)

    Parameters

    docuViewareID
    The identifier for the DocuVieware™ instance.
    callback
    The function you want to execute on event.

    Return Value

    1 if error.

    Example of usage

    This JavaScript makes sure the DocuVieware control is properly loaded and initialized and then subscribes to the event on load.

    function RegisterOnViewerScrollOnDocuViewareAPIReady() {
        if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
            DocuViewareAPI.RegisterOnViewerScroll("DocuVieware1", function () { console.log("viewer scrolled"); });
        }
        else {
            setTimeout(function () { RegisterOnViewerScrollOnDocuViewareAPIReady() }, 10);
        }
    }
    document.addEventListener("DOMContentLoaded", function () {
        RegisterOnViewerScrollOnDocuViewareAPIReady();
    }, false);