How to call a function when the block visibility changes?

When the user clicks on the map, the address_box code block becomes visible.

<div id="adress_box" style="visibility: hidden">We are looking for delivery to <span id="address_confirm"></span></div>

How do I make the code below run when the visibility changes to visible?

alert('div is  display!!!');

so far, I have only achieved that when the page loads, a similar code is executed:

<div id="adress_box" style="visibility: hidden">Ищем доставку по адресу <span id="address_confirm"></span></div>

<script>
let element = document.getElementById('address_confirm');
let cssObj = window.getComputedStyle(element);
if (cssObj.getPropertyValue("visibility") == 'visible') {
    alert('div is NOT display!!!');
}
</script>