Home > Article > Web Front-end > How to implement pop-up layer covering the entire page using js and css_javascript skills
The example in this article describes the method of using js and css to implement a pop-up layer covering the entire page. Share it with everyone for your reference. The specific implementation method is as follows:
The common styles and structures of pop-up layers with transparent background frames are as follows:
How to cover the entire webpage with pop-up layer background
1.css method
2.js method
var bgWidth = document.body.clientWidth 'px',
bgHeight = document.body.clientHeight 'px',
alertBgNode = $('.alertMessageBg');
alertBgNode.css({'width':bgWidth,'height':bgHeight});
Comparing the above two methods, it is obvious that the css method is more trouble-free, especially now that it is not compatible with IE6.
I hope this article will be helpful to everyone’s web programming based on JS.