A
A
aby1252019-10-02 11:56:41
1C-Bitrix
aby125, 2019-10-02 11:56:41

How to hang js script on bx-panel in Bitrix?

I want to make it possible to move the bitrix panel id = 'bx-panel' vertically with the mouse. The java script code itself is
var bx_panel = document.getElementById('bx-panel');
bx_panel.onmousedown = function(e) {...//code for dragging bx_panel here} I inserted
it into the js code of the site template script, the problem is that bx_panel is null, i.e. as I understand it, it has not loaded yet, but is already trying to complete. Therefore, the question itself arose, how competently and conceived in Bitrix to hang scripts on the admin panel?
If I insert my js code into the console when the page is fully loaded, it works correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2019-10-02
@aby125

Try to hang script initialization on BX.ready - https://dev.1c-bitrix.ru/api_help/js_lib/kernel/bx.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question