DocuVieware Reference Guide
RegisterOnZoomChanged
Reference Guides > JavaScript API > Events > RegisterOnZoomChanged
 RegisterOnZoomChanged

This function allows you trigger a function of your own when the zoom change event is fired.

RegisterOnZoomChanged: 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 RegisterOnZoomChangedOnDocuViewareAPIReady() {
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
        DocuViewareAPI.RegisterOnZoomChanged("DocuVieware1", function () { console.log("zoom changed"); });
    }
    else {
        setTimeout(function () { RegisterOnZoomChangedOnDocuViewareAPIReady() }, 10);
    }
}
document.addEventListener("DOMContentLoaded", function () {
    RegisterOnZoomChangedOnDocuViewareAPIReady();
}, false);