I need tu run javascript (Stop JWPlayer) when DIV shows up. It shows approx. 15 sec after page is fully loaded.
The code I have so far
if (document.getElementById("overlay_div")) { jwplayer().stop(); }
i guess my code looks for overlay_div at the time of page load, and not after some time (15 sec in this case)
Edit: it turns out that DIV is actually there all the time but it switches from display: none to display:block after this time interval. Is there any way to run script whan div turns to display: block
Edit2: I managed to solve this on my own with the help of @elbunuelo Here is the code in case anyone needs it:
var interval = setInterval(function(){
if (document.getElementById("overlay_main_div").style.display=="block"){
jwplayer().stop();
clearInterval(interval);
} }, 1000);