How do I do something to the body while a popu is showing

Well there is a little bit of javascript in here but when a popup in my game shows I want to disable all other things on the screen and make them not respond and create a little tint over everything but the popup. And when the user closes the popup everything resumes. I have no idea I tried to file with js but had no luck.

The popup is here https://idle-command.netlify.app/ just click on the pickaxe from the shop and inspect. Here is the js for that one popup.

let sellOrePop = null;
function sellOre() {
    if(sellOrePop === null) {
        document.getElementById("soldOre").style.display = "block";
        sellOrePop = true;
    }
    else {
        document.getElementById("soldOre").style.display = "none";
        sellOrePop = null;
    }
}

Fixed! it works now. If it dosent please tell me

It sounds like you want a modal dialog. There is a dialog HTML element which in theory would provide this for you, but in reality it is not quite up to speed in all browsers. Modals are not easy to implement accessibly, so I would recommend you use one that is well-known and tested for accessibility. The best one I know of is a11y-dialog.

well if you looked at my code thats what I wanted inspect my website after clicking picaxe and fing the popup model

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.