Skip to content

Tag: dom

Detecting iframe removed by parent

I have a web application that is embedded in an iframe by external sites, of which we have no control over. Is there a way to detect when the iframe element has been removed from the dom of the parent, in order to perform some cleanup before it’s gone? It appears to fire a “visibilitychange”…

Javascript click event doesnt accept two same function

I want to use joinLobby(‘create’) and joinLobby(‘join’) functions in one page. But when I reload the page, joinLobby function working instantly. How can I prevent instant work? Answer Just having the functions like that runs them instantly. Try something like this:

How To identify which Div is displaying the scrollbar

My dashboard app is a single page – never longer than 100vh. In a certain place, when I click a button, some unknown container temporarily overflows and a scrollbar appears on the right side, and then one second later it disappears. During that one second, the page background jumps very noticeably. I wi…

use “this” in a function passed to eventListener

Hello people I was refactoring some code and couldn’t figure a way to reuse the ‘this’: a/ Code I have b/ I want to move the function to another file and export it as: and use it like: but ‘this’ is undefined.. how do I bind it? Answer Pass this as parameter to function (and also…