Scroll Parent Window BX24.scrollParentWindow
Choose a tool for developing with an AI agent:
- use Alaio Vibecode to build an app for Bitrix24 from a task description without knowing any programming language. The agent writes the code and deploys the app to a server, with no manual hosting setup
- use the MCP server to develop a REST API integration in your own project. The agent refers to the official REST documentation
BX24.scrollParentWindow(scroll: integer | string, callback?: callable): void;
The BX24.scrollParentWindow method scrolls the parent window — the Bitrix24 page that contains the application frame — to the specified vertical position. For example, if the application frame is taller than the screen, a "Back to top" button at the bottom of the application can return the user to the top of the page.
Starting from version 25.800.0 of the rest module, this method can be used in embedding locations of the application. Scrolling works if the application is not open in a slider, for example, on its own page in Bitrix24. In the window opened by BX24.openApplication, the page does not scroll.
The method works only inside the application frame in Bitrix24. Call it after the library is initialized, in the BX24.init handler. The method requires no scope of its own: it controls the interface and does not call the REST API.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
scroll* |
The position in pixels from the top of the Bitrix24 page. |
|
callback |
Callback function. It receives an object with the passed position (detailed description) |
Code Example
How to Use Examples in Documentation
Scroll the Bitrix24 page to the top on a button click:
<button id="scroll-top">Back to top</button>
<script>
BX24.init(function () {
document.getElementById('scroll-top').addEventListener('click', function () {
BX24.scrollParentWindow(0, function (result) {
console.log('Position:', result.scroll);
});
});
});
</script>
Response Handling
The method does not return data (void). When Bitrix24 processes the command, it calls callback and passes an object with the position you specified:
{
"scroll": 0
}
Returned Data
|
Name |
Description |
|
scroll |
The position from the |
Error Handling
The method does not return error codes.
|
Situation |
What Happens |
What to Do |
|
|
The page does not scroll, and |
Pass a number |
|
A negative number is passed in |
The page does not scroll, but |
Pass |
|
The application is open in a slider, for example, in the BX24.openApplication window |
The page does not scroll, but |
Scroll the content inside the frame from the application page itself, for example, with |