Javascript: TableOfContents.scrollTo Method
Description
Sets the current input position to the beginning of a table of contents and scrolls it into the visible part of the document.
Syntax
<void> TableOfContents.scrollTo(<RequestBooleanCallback> callback, [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| callback | Receives whether the call was succesful. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates TableOfContents.scrollTo in a practical document-editing workflow. It sets the current input position to the beginning of a table of contents and scrolls it into the visible part of the document.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function scrollTo(tableOfContents) {
tableOfContents.scrollTo(
function(result) {
if (result) {
console.log("scroll to is available.");
} else {
console.warn("scroll to is not available in the current document state.");
}
},
onTxError
);
}