Javascript: Footnote.scrollToPosition Method
Description
Scrolls the beginning of the footnote mark into the visible part of the document using the specified position.
Syntax
<void> Footnote.scrollToPosition(<InputPosition.ScrollPosition> scrollPosition, [<EmptyRequestCallback> callback], [<ErrorCallback> errorCallback])Parameters
| Parameter | Description |
|---|---|
| scrollPosition | Specifies the position to scroll to. |
| callback | Optional. Is called when the operation completed. |
| errorCallback | Optional. Is called when the operation failed with an error. |
Examples
The following example demonstrates Footnote.scrollToPosition in a practical document-editing workflow. It scrolls the beginning of the footnote mark into the visible part of the document using the specified position.
function onTxError(error) {
console.error("TX Text Control error:", error.msg);
error.handled = true;
}
function scrollToPosition(scrollPosition) {
TXTextControl.footnotes.elementAt(0, function(footnote) {
if (!footnote) {
console.warn("No footnote is available.");
return;
}
footnote.scrollToPosition(
scrollPosition,
function() {
console.log("scroll to position completed.");
},
onTxError
);
}, onTxError);
}