html - Fade out image shown on hover after mouse leaves area using CSS -


working on new homepage, in wordpress using html editor because wordpress themes slow site down hec. i'm ready go, wondering how accomplish following:

on staging page here can see image appears in front of it. want image fade out after mouse moves off image.

here's code got going:

<div class="imagebox"> <div class="imageinn">     <img src="https://pausethemoment.photography/wp-content/uploads/2017/07/melbourne-wedding-photography-pause-the-moment-beach-wedding-photography-610x345.jpg" alt="sandringham melbourne wedding photography - sun sets on couple on beach."> </div> <div class="hoverimg">     <a href="https://pausethemoment.photography/contact-us/"><img src="https://pausethemoment.photography/wp-content/uploads/2017/07/wedding-photography-melbourne-limited-dates-overlay.png" alt="pause moment melbourne wedding photography" width="610" height="345" class="aligncenter size-full wp-image-14308" /></a> </div> </div> 

and css:

.imagebox      {         position: relative;         float: left;     }     .imagebox .hoverimg {         visibility:hidden;         position: absolute;         left: 0;         top: 0;         opacity: 0;         transition: visibility 0s, opacity 0.5s linear;     }     .imagebox:hover .hoverimg {                 display: block;         visibility: visible;         opacity: 1;     } 

have tried using ::after tag on

 .imagebox .hoverimage 

in various formats this:

.imagebox:hover::after .hoverimg          {         visibility:visible;         position: absolute;         left: 0;         top: 0;         opacity: 0;         } 

but no avail. have played around animation delays etc, can't seem stay on there! tried webkit transitions couldn't them fade in. appreciated!

the problem seems using visibility property. css transition doesn't know how generate intermediate values between "visible" , "hidden" because values not numeric.

try removing occurrences of visibility , applying transition opacity only.

.imagebox {     position: relative;     float: left; } .imagebox .hoverimg {     /*visibility:hidden;*/     position: absolute;     left: 0;     top: 0;     opacity: 0;     transition: /*visibility 0s,*/ opacity 0.5s linear; } .imagebox:hover .hoverimg {             display: block;     /*visibility: visible;*/     opacity: 1; } 

Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -