JavaScript Overlay Image with text with Bootstrap 4 overlay image with text,overlay image with color css,overlay

I'm very new to web development so have mercy with your responses.

I have a grid of images that I want to modify. When the mouse hovers over an image, I want an overlay with text to appear over the image (this may require the cell in the grid to expand to contain all the text).

When the image with the overlay is clicked, it should open a modal (I already have this working) with the full text and info inside.

All changes need to look smooth with transitions (overlay shouldn't just be there when the mouse touches, it should animate in, etc.) when they enter/exit.

I'm not sure what the right terminology is for this, so I'm struggling to find info searching on Google. So, if you could provide me with some resources to learn this, or provide some examples, it'd be much appreciated. Thanks in advance :)

Edit: Here's close to what I want to happen There will be an image, like this:an image in a grid

After the mouse hover over this image, an overlay should animate in to look like this: overlay showing over top of image in grid

The difference between this and what I want, is I want to show text instead of an icon, and I also want the cell in the grid upon which the mouse is hovering to expand to more pleasantly present the text that will be shown on the overlay.

Answer:1

You can do this with just css first you need to wrap your image in a div and set the position to relative. Then place the image and the overlay inside of it. Then you can use css transitions to achieve the desired effect. You will set the original opacity of the overlay to 0 and set the hover opacity to 1. Below is an example. Since you haven't posted any code I can't tell what your markup will be so I just made an example.

.img-container{
  position:relative;
  display:inline-block;
}
.img-container .overlay{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgb(0,170,170);
  opacity:0;
  transition:opacity 500ms ease-in-out;
}
.img-container:hover .overlay{
  opacity:1;
}
.overlay span{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  color:#fff;
}
<div class="img-container">
  <img src="https://placehold.it/300x300">
  <div class="overlay">
    <span>overlay content</span>
  </div>
</div>
Answer:2

Set image as "block"

.img-container{
  position:relative;
  display:inline-block;
}
.img-container img{
display:block
 }
.img-container .overlay{
  position:absolute;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgb(0,170,170);
  opacity:0;
  transition:opacity 500ms ease-in-out;
}
.img-container:hover .overlay{
  opacity:1;
}
.overlay span{
  position:absolute;
  top:50%;
  left:50%;
  transform:translate(-50%,-50%);
  color:#fff;
}
<div class="img-container">
  <img src="https://placehold.it/300x300">
  <div class="overlay">
    <span>overlay content</span>
  </div>
</div>
Answer:3

I have a "sign up" button. When it is clicked, I would like for it to render a new component, called "SignUp". I would like for the new component to replace the "sign up" button. Currently, I am ...

I have a "sign up" button. When it is clicked, I would like for it to render a new component, called "SignUp". I would like for the new component to replace the "sign up" button. Currently, I am ...

  1. replace react component
  2. react replace component on click
  3. react replace component with another
  4. replace string with react component
  5. react replace child component
  6. react replace one component with another
  7. replace text with react component
  8. react replace html with component
  9. react replace element with component

I need to include checkboxes as options in dropdown menu in Angular.

I need to include checkboxes as options in dropdown menu in Angular.

Im trying to change between two colors when I click on the event listener using JavaScript. When I trigger the click event, it changes the color to black. When I click on it again, I want it to change ...

Im trying to change between two colors when I click on the event listener using JavaScript. When I trigger the click event, it changes the color to black. When I click on it again, I want it to change ...

  1. switch between different chrome windows mac
  2. switch between different windows mac
  3. switch between different python versions
  4. switch between different jdk versions in mac
  5. switch between different windows of the same application mac
  6. switch between different windows in selenium
  7. switch between different java versions windows
  8. switch between different jdk versions in windows
  9. switch between different sheets in excel
  10. switch between different jdk versions in linux
  11. switch between different windows
  12. switch between different java versions
  13. switch between different java versions mac
  14. switch between different jre versions in windows
  15. switch between different network settings
  16. switch between different excel files
  17. switch between different node versions
  18. switch between different workbooks in excel
  19. switch between different branches in git
  20. switch between different browsers

I realize that this is improper syntax, but why is JavaScript ignoring the first number and giving a response instead of breaking? let myArray = [1,2,3,4] myArray[0,1] // 2 myArray[1,3] // 4 myArray[...

I realize that this is improper syntax, but why is JavaScript ignoring the first number and giving a response instead of breaking? let myArray = [1,2,3,4] myArray[0,1] // 2 myArray[1,3] // 4 myArray[...

  1. passing values in java
  2. passing values in url
  3. passing values in python
  4. passing values in javascript function
  5. passing values in c
  6. passing values in url php
  7. passing values in query string c#
  8. passing values in php
  9. passing values in python functions
  10. passing values in javascript
  11. passing values in onclick of javascript
  12. passing values in hyperlink html
  13. passing values in intent
  14. passing values in react
  15. passing values in url javascript
  16. passing values in html
  17. passing values in vba
  18. passing values in postman
  19. passing values in ajax
  20. passing values in angular