In This Topic
Reference Guides / JavaScript API / Events / RegisterOnSnapInPanelResized

RegisterOnSnapInPanelResized

In This Topic
 RegisterOnSnapInPanelResized

This function allows you to trigger a function of your own when the Snap-In panel is resized.

This callback won't be triggered when the Snap-In panel is collapsed or expanded, if you need to do something when it happens, please see RegisterOnSnapInPanelToggle.
RegisterOnSnapInPanelResized: function (docuViewareID, callback)

Parameters

docuViewareID
The identifier for the DocuVieware™ instance.
callback
The function you want to execute on event.
The callback will recieve an integer as argument that is the Snap-In panel width after resize.

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 RegisterOnSnapInPanelResizedOnDocuViewareAPIReady() {
    if (typeof DocuViewareAPI !== "undefined" && DocuViewareAPI.IsInitialized("DocuVieware1")) {
        DocuViewareAPI.RegisterOnSnapInPanelResized("DocuVieware1", function (newWidth) { console.log("new width is", newWidth); });
    }
    else {
        setTimeout(function () { RegisterOnSnapInPanelResizedOnDocuViewareAPIReady() }, 10);
    }
}
document.addEventListener("DOMContentLoaded", function () {
    RegisterOnSnapInPanelResizedOnDocuViewareAPIReady();
}, false);