Osm Image hover effect

html-
<div class="frame">
    <div class="image">
     <img     src="https://farm3.staticflickr.com/2453/3583222981_8286679269_n.jpg" alt="coffee">
        <div class="backdrop"></div>
        <div class="button"></div>
</div>
<div class="image">
<img src="https://farm9.staticflickr.com/8229/8575403413_12a4b4df33_n.jpg" alt="camp">
    <div class="backdrop"></div>
    <div class="button"></div>
</div>

<div class="image">
    <img src="https://farm2.staticflickr.com/1283/646448538_aa0b73cec4_z.jpg" alt="beach camping">
    <div class="button"></div>
    <div class="backdrop"></div>
    </div>
   
<div class="image">
        <img src="https://farm7.staticflickr.com/6031/5892882006_192d4f4406.jpg" alt="fire">
    <div class="backdrop"></div>
<div class="button"></div>
</div>

<div class="detail">
    <div class="close"></div>
    <div class="top"><img src="https://farm2.staticflickr.com/1274/4670974422_ec49d65ab2_n.jpg"/></div>
    <div class="bottom">
        <h4>Amanda Fernandes</h4>
        <i class="fa fa-github" aria-hidden="true"></i>
        <i class="fa fa-codepen" aria-hidden="true"></i>
        <i class="fa fa-twitter" aria-hidden="true"></i>

    </div>
    <div class="profile-image"><img src="https://avatars3.githubusercontent.com/u/28960698?s=400&u=a9f029afaa4f3d4494bb83a8bfd72f5ff940287f&v=4" alt="profilepic"></div>
</div>
</div>

css-

@import url(https://fonts.googleapis.com/css?family=Open+Sans:700,300);
* {
  box-sizing: border-box;
}

.frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 400px;
  height: 400px;
  margin-top: -200px;
  margin-left: -200px;
  border-radius: 2px;
  box-shadow: 4px 8px 16px 0 rgba(0, 0, 0, 0.1);
  overflow: hidden;
  background: #fff;
  color: #333;
  font-family: 'Open Sans', Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: grid;
  grid-template-columns: 50% 50%;
  grid-template-rows: 50% 50%;
  grid-row-gap: 5px;
  grid-column-gap: 5px;
}

.center {
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

.image {
  overflow: hidden;
  width: 195px;
  height: 195px;
  position: relative;
}
.image .backdrop {
  position: relative;
  width: 195px;
  height: 195px;
  background: #ff0000;
  left: 0;
  top: 0;
  opacity: 0.8;
  transition: all 0.5s ease-in-out;
}
.image .button {
  position: absolute;
  background: red;
  width: 50px;
  height: 50px;
  color: white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%) scale(0.05);
          transform: translate(-50%, -50%) scale(0.05);
  margin: 0;
  padding: 0;
  opacity: 0;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.8);
  transition: all 0.5s ease-in-out;
}
.image .button:before {
  position: absolute;
  content: '';
  background: #fff;
  height: 15px;
  width: 2px;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}
.image .button:after {
  position: absolute;
  content: '';
  background: #fff;
  height: 15px;
  width: 2px;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%) rotate(90deg);
          transform: translate(-50%, -50%) rotate(90deg);
}
.image:hover .backdrop {
  opacity: 0.2;
  -webkit-transform: translate(0, -100%) scale(1.05);
          transform: translate(0, -100%) scale(1.05);
}
.image:hover .button {
  -webkit-transform: translate(-50%, -50%) scale(1);
          transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  cursor: pointer;
  visibility: visible;
}

.detail {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
}
.detail .close {
  position: absolute;
  cursor: pointer;
  background: red;
  z-index: 7;
  width: 50px;
  height: 50px;
  color: white;
  border-radius: 50%;
  top: -10%;
  right: 10%;
  margin: 0;
  padding: 0;
  -webkit-transform: scale(0.3);
          transform: scale(0.3);
  transition: all 0.3s cubic-bezier(0.785, 0.135, 0.15, 0.86) 0.3s;
  box-shadow: 3px 3px 10px rgba(0, 0, 0, 0.8);
}
.detail .close:before {
  position: absolute;
  content: '';
  background: #fff;
  height: 15px;
  width: 2px;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%) rotate(45deg);
          transform: translate(-50%, -50%) rotate(45deg);
}
.detail .close:after {
  position: absolute;
  content: '';
  background: #fff;
  height: 15px;
  width: 2px;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, -50%) rotate(-45deg);
          transform: translate(-50%, -50%) rotate(-45deg);
}
.detail .top {
  width: 100%;
  height: 50%;
  position: absolute;
  top: 0;
  left: 0;
  -o-object-fit: cover;
     object-fit: cover;
  overflow: hidden;
  -webkit-transform: translate(0%, -100%);
          transform: translate(0%, -100%);
  transition: -webkit-transform 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
  transition: transform 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
  transition: transform 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86), -webkit-transform 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.detail .bottom {
  width: 100%;
  height: 50%;
  text-align: center;
  background: #ff0000;
  color: white;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-50%, 100%);
          transform: translate(-50%, 100%);
  transition: all 0.4s cubic-bezier(0.785, 0.135, 0.15, 0.86);
}
.detail .bottom i {
  margin-right: 25px;
  font-size: 1.5em;
  padding: 7px;
  border: 2px solid white;
  border-radius: 50%;
}
.detail .bottom i:nth-last-of-type(1) {
  margin-right: 0;
}
.detail .profile-image {
  overflow: hidden;
  width: 110px;
  height: 110px;
  position: absolute;
  top: 50%;
  left: 50%;
  -webkit-transform: translate(-300%, -50%);
          transform: translate(-300%, -50%);
  transition: all 0.7s ease-in 0.2s;
  border: 3px solid green;
  border-radius: 50%;
  z-index: 6;
}
.detail.active {
  pointer-events: all;
}
.detail.active .close {
  -webkit-transform: translate(0, 70px) scale(1);
          transform: translate(0, 70px) scale(1);
}
.detail.active .top {
  -webkit-transform: translate(0, 0);
          transform: translate(0, 0);
}
.detail.active .bottom {
  padding-top: 3em;
  -webkit-transform: translate(-50%, 0%);
          transform: translate(-50%, 0%);
}
.detail.active .profile-image {
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

img {
  width: 100%;
  height: 100%;
  -o-object-fit: cover;
     object-fit: cover;
}

Result / Demo :-

https://codepen.io/pkp1593/pen/zmdqem
 

Comments