I use the div owerlay to dim the screen during a popup message.

I click on the button, a message appears, the screen is dark. Close the message. I press the button again, the message appears, and the screen does not darken!

And if you press the right button and select " View element code " in the drop-down list, the blackout appears abruptly. It appears the same way, I look through the code in the html page in the inspector and just use the mouse to navigate the html tree.

Moreover, a div appears, a click is placed on it and it works. It seems that the browser does not draw blackout))

What it is? How to fix this oddity?

I use the Google Chrome browser . PS Checked in the mozilla , everything is ok.

  • 7
    Error 17 line. - Yura Ivanov
  • What are you about?? - MatthewP
  • What version of chrome? - dzhioev
  • @MatthewPatell, you are hinted to show your code. - VenZell
  • There was a similar problem, the solution in the answer hashcode.ru/questions/311635/… - Heidel

1 answer 1

After you show the overlay, find it and ask for its width before the next actions. This will force the browser to reflow and it is guaranteed to be displayed.