jq Adding an instance of an overlay mask to a page
- 2021-07-21 07:19:33
- OfStack
The jq code is introduced first, and then the code is as follows:
$(function(){
var docHeight = $(document).height(); // Get window height
$('body').append('<div id="overlay"></div>');
$('#overlay')
.height(docHeight)
.css({
'opacity': .9, // Transparency
'position': 'absolute',
'top': 0,
'left': 0,
'background-color': 'black',
'width': '100%',
'z-index': 5000 // Ensure that this suspension layer is above other contents
});
setTimeout(function(){$('#overlay').fadeOut('slow')}, 3000); // Settings 3 The coating fades out automatically after seconds
});