javascript - 内容的淡入淡出过渡

标签 javascript html css

这个过渡现在不太漂亮,但是我怎样才能使悬停时向上滑动和悬停后向下滑动比现在更好?
这是此代码的演示 JSFiddle (代码太多)

.employee-box {
border:2px solid #F9BA16;
background:#fff;
height:500px;
width:350px;
mediamax-width:480px {;
max-width:250px;
margin:0 auto 35px;
}

hr {
width:100%;
border-color:#fff;
border-width:6px;
margin:0 auto;
}

img {
max-height:430px;
padding:40px 0 20px;
}

.employee-more {
position:relative;
-webkit-transition:all .4s ease-out;
-o-transition:all .4s ease-out;
transition:all .4s ease-out;
imgposition:relative;
background:#fff;
border-radius:50%;
width:39px;
height:39px;
top:-20px;
left:43%;
padding:10px;
}

h1 {
text-align:center;
font-size:28px;
color:#fff;
padding-bottom:10px;
margin:-15px 0 0;
}

.details {
display:none;
text-align:center;
details-addressfont-size:20px;
font-style:italic;
}

i {
color:#fff;
border-radius:50%;
border:3px solid #fff;
width:40px;
height:40px;
font-size:22px;
fa-envelopepadding:6px 5px;
}

&.fa-phone {
padding:8px 0;
}

.details-contact {
font-size:30px;
color:#fff;
font-style:italic;
}

.details-desc {
font-style:italic;
font-size:14px;
padding:5px 10px;
}

.employee-rank {
position:absolute;
padding-top:40px;
bottom:-33px;
left:25%;
ppadding-bottom:32px;
text-align:center;
font-size:16px;
}

&:hover {
employee-moretop:-438px;
background:rgba(#F9BA16,.9);
height:465px;
transition:all .4s ease-in;
detailsdisplay:block;
}

最佳答案

检查这个我希望你喜欢它: https://jsfiddle.net/72bd2zhb/2/

$PrimaryColor: #F9BA16;
section.bok-employees {
  .bok-employees-content {
    .bok-employees-boxes {
      .employee-box {
        border: 2px solid $PrimaryColor;
        background: #fff;
        position:relative;
        height: 500px;
        width: 350px;
        margin: 0 auto 35px;
        overflow:hidden;
        @media ( max-width: 480px) {
          max-width: 250px;
        }
        hr {
          border-width: 6px;
          border-color: $PrimaryColor;
          width: 112px;
          margin: 0 auto;
        }
        img {
          padding: 40px 0 20px;
          max-height: 430px;
        }
        .employee-more {
          background: $PrimaryColor;
          position: relative;
          top: -40px;
          -webkit-transition: all 0.5s ease-out;
          -o-transition: all 0.5s ease-out;
          transition: all 0.5s ease-out;
          img {
            position: relative;
            background: #fff;
            border-radius: 50%;
            padding: 10px;
            width: 39px;
            height: 39px;
            top: -20px;
            left: 43%; //110px;
            @include rotateAnimation();
          }
          h1 {
            margin: 0;
            text-align: center;
            font-size: 28px;
            color: #fff;
            margin-top: -15px;
            padding-bottom: 10px;
            @include BoldItalic();
          }
          .details {
            opacity: 0;
            text-align: center;
            -webkit-transition: all 0.5s ease-out;
          -o-transition: all 0.5s ease-out;
          transition: all 0.5s ease-out;
            .details-address {
              font-size: 20px;
              font-style: italic;
            }
            i {
              color: #fff;
              border-radius: 50%;
              border: 3px solid #fff;
              width: 40px;
              height: 40px;
              font-size: 22px;
              &.fa-envelope {
                padding: 6px 5px;
              }
              &.fa-phone {
                padding: 8px 0;
              }
            }
            .details-contact {
              font-size: 30px;
              color: #fff;
              font-style: italic;
            }
            hr {
              border-color: #fff;
              width: 100%
            }
            .details-desc {
              font-style: italic;
              font-size: 14px;
              padding: 5px 10px;
            }
          }
        }
        .employee-rank {
          position: absolute;
          //padding-top: 40px;
          bottom: -33px;
          left: 0;
          right:0;
          -webkit-transition: all 0.5s ease-out;
              -o-transition: all 0.5s ease-out;
              transition: all 0.5s ease-out;
          p {
            padding-bottom: 32px;
            text-align: center;
            font-size: 16px;
          }
        }
        &:hover {
          .employee-more {
            top: -405px;
            background: rgba( $PrimaryColor, .9);
            height: 465px;
            -webkit-transition: all 0.5s ease-in;
            -o-transition: all 0.5s ease-in;
            transition: all 0.5s ease-in;
            .details {
              opacity: 1;
              -webkit-transition: all 0.5s ease-out;
              -o-transition: all 0.5s ease-out;
              transition: all 0.5s ease-out;

            }
          }
          .employee-rank {
                bottom:-60px;
                 -webkit-transition: all 0.5s ease-out;
                  -o-transition: all 0.5s ease-out;
                  transition: all 0.5s ease-out;
                }
        }
      }
    }
  }
}

关于javascript - 内容的淡入淡出过渡,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36387986/

相关文章:

javascript - 添加 keydown 事件监听器可阻止我通过在 chrome 中按 F-12 检查 HTML 元素

html - 在选择选项中有一个占位符

html - 使 li 元素水平堆叠

javascript - 如何使用 Gulp 将多个 typescript 文件编译成一个 javascript 文件?

javascript - require 关键字周围的 try catch block

HTML5 : Is iPhone4's hardware acceleration that much weaker than compared to the 4s?

javascript - 自动调整文本区域宽度(列)?

css - 如何制作具有不同行高的语义 UI React 网格全屏?

javascript - 计算在 ie9 中不起作用

javascript - 如何将长标签文本包装在 d3 的气泡图中?