create overlay js

footer#site-footer{  
  position:relative;
}

footer#site-footer:before {     /* use before property (pseudo-element)  */
    position: absolute;
    content: '';
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
}

4.17
5
Awgiedawgie 440220 points

                                    
<body>
  <div id="#overlay">
    
  </div>
  <div> content </div>
</body>

//first create an element with folowing styles
#overlay {
  position: fixed; /* Sit on top of the page content */
  display: none; /* Hidden by default */
  width: 100%; /* Full width (cover the whole page) */
  height: 100%; /* Full height (cover the whole page) */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0,0,0,0.5); /* Black background with opacity */
  z-index: 2; /* Specify a stack order in case you're using a different order for other elements */
  cursor: pointer; /* Add a pointer on hover */
}

//then you can do
const on = () => {
  document.getElementById("overlay").style.display = "block";
}

const off = () => {
  document.getElementById("overlay").style.display = "none";
}

4.17 (6 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
div overlay image color overlay color for image css javascript overlay your javascript overlay tutorial color overlay on image in css javascript page overlay javascript overlay style color overlay image how to overlay effect in javascript how to add overlay color image html create overlay html css js make color overlay css image overlay color css after css for overlay image with color add color overlay image overlay css image color overlay color over background image overlay a color on an image in css overlay an image with color css add overlay color to image on hover css css color overlay images how to overlay a color over a pictuer css/html css overlay image with color overlay with javascript image overlay color css adding overlays javascript background overlay color css on image div background image color overlay add image overlay color css css png image color overlay photo add image overlay color background image and color overlay css how to overlay image with color? color overlay image on css html give overlay color to image colour overlay on image css html javascript create overlay color overlay on a photo css how to make a background color with image overlay in css color overlay css background image how to add a white overlay on an image in css html overlay color on image color overlay on hover image css overlay image on color background css CSS overlay color on img tag image color overlay : after html overlay image with color overlay window javascript javascript website overlay overlay display javascript add overlay color to image picture color overlay image hover color overlay css how to create an overlay in javascript for windows how to create an overlay in javascript add color overlay on image css javascript $.overlay image overlay change color white how to apply color overlay over image in css overlay color on img element css on hover image color overlay background color overlay image create a overlay element in js css red overlay for image add overlay using javascript how to create overlay frame with javascript image color overlay how to add colour as a overlay for an image how to add colour as a overlay for an imahe overlay color in image css how to add overlay color in css add image color overlay css what is overlay in js background image overlay div with color css add overlay color to image css how to overlay color on image in css css image colour overlay html image color overlay css background image color overlay add color overlay to image css color overlay on image css image overlay with color create overlay element javascript html create overlay create overlay javascript show color overlay on the image color overlay on an image css overlay js html image overlay background color css add color overlay on image overlay color background image css how to add overlay color css css how to overlay a color on a pic background image with overlay color background image with different color overlay css apply color overlay to image css img tag color overlay css html background image color overlay background image with color overlay js make overlay css background overlay image and color overlay colours on image onlien overlay image color background image color overlay css image colour overlay overlay color css image how to add color overlay to image in css overlay black on image css css overlay color on image color overlay on background image css background color overlay image css js overlay colour overlay background image css creating overlays in javascript overlay color over image css overlay javascript how to make an img color overlay with css css background image with overlay color background image overlay color css css overlay color on background image how to add image opasity and color overlays for photos in css color overlay on image background overlay image color css html css image color overlay background image with color overlay css overlay color on image css color overlay image png img src overlay color add color overlay to background image css overlay color for img html overlay color fomr img html overlay color in img css color overlay an image css overlay in javascript overlay color on background image css html color overlay on image css photo overlay color css overlay color over image css color image overlay w3s overlay a color on an image css css background image overlay color overlay js javascript overlay add an overlay color to background image background image color overlay dark overlay in css image overlay javascript. javascript overlay image color overlay img custom overlay css overlay js css css img color overlay image with color overlay css html make overlay overlay banner css how to overlay a colour to an imnage css image overlay color color overlay css on image color overlay on image how to make overlay without div in css black Overlay effect using html css css property overlay best css image ovelays color add color overlay to image create overlay js css overlay image div see through overlay color grey overlay writing input html html create a form overlay add overlay to image overlay on image with css overlay color image css overlay property in css add overlay to image css black overlay on image css html overlay div on image add color overlay to image on hover css how to add color on image in css colorful overlays css css image overlay color how to make overlay in website css background image and color overlay image overlay in css color overlay for image css html image overlay color bg image whit color overlay darken css backgrond image without affecting overlay css overlay image color hover css no overlay div css how to make an overlay tag transparent how to overlay transparent color on image in css add div overlay overlay boottsrap css add overlay blue apply overlay on image css overlay image with color css image color overlay css css color over image how to overlay a div in css how to put overlay on image css overlay of color in css backgroud image overlay css css color mask over image how to make blue overlay on image css css image tint overlay color overlay image css overlay color img css css override image color overlay black css color overlay css image dark overlay css css overlay imag + color make overlay using css change overlay color in css change the overlay color css color overlay for image in css Simple Overlay background add color to image css overlay background css3 how to add overlay color on image in css css add color overlay to image css image and color overlay add a abckgroud overlay css css color overlay image css image color overlay overlapse css css add colour overlay to image css color overlay over background image slight overlay css making overlays css and html overlay color on image css
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source