图像悬停效果 [英] Image Hover effect

查看:152
本文介绍了图像悬停效果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图片悬停效果,它悬停好。但我需要只是像底部..因为现在一切都隐藏,直到你悬停然后它显示...我已经尝试修改边缘和填充没有运气



此处演示图片



.hovereffect {width:100%;高度:100%; float:left; overflow:hidden;位置:相对; text-align:center; cursor:default;}。hovereffect .overlay {width:100%; position:absolute; overflow:hidden; left:0; top:auto; bottom:0; padding:1em; height:4.75em;背景:#79FAC4;颜色:#3c4a50; -webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s; -webkit-transform:translate3d(0,100%,0); transform:translate3d(0,100%,0);}。hovereffect img {display:block;位置:相对; -webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s;}。hovereffect:hover img {-webkit-transform:translate3d(0,-10%,0); transform:translate3d(0,-10%,0);}。hovereffect h2 {text-transform:uppercase; color:#fff; text-align:center;位置:相对; font-size:17px; padding:10px;背景:rgba(0,0,0,0.6); float:left; margin:0px; display:inline-block;}。hovereffect a.info {display:inline-block; text-decoration:none; padding:7px 14px; text-transform:uppercase; color:#fff; border:1px solid #fff; margin:50px 0 0 0;背景颜色:透明;}。hovereffect a.info:hover {box-shadow:0 0 5px #fff;}。hovereffect p.icon-links a {float:right;颜色:#3c4a50; font-size:1.4em;} hovereffect:hover p.icon-links a:hover,.hovereffect:hover p.icon-links a:focus {color:#252d31;} hovereffect h2,.hovereffect p.icon-链接一个{-webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s; -webkit-transform:translate3d(0,200%,0); transform:translate3d(0,200%,0);}。hovereffect p.icon-links a span:before {display:inline-block; padding:8px 10px;英语: -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;} hovereffect:hover .overlay,.hovereffect:hover h2,.hovereffect:hover p.icon-links a {-webkit-transform:translate3d(0,0,0) transform:translate3d(0,0,0);}。hovereffect:hover h2 {-webkit-transition-delay:0.05s; transition-delay:0.05s;} hovereffect:hover p.icon-links a:nth-​​child(3){-webkit-transition-delay:0.1s; transition-delay:0.1s;} hovereffect:hover p.icon-links a:nth-​​child(2){-webkit-transition-delay:0.15s; transition-delay:0.15s;} hovereffect:hover p.icon-links a:first-child {-webkit-transition-delay:0.2s; transition-delay:0.2s;}

 < div class =col-lg-3 col-md-4 col-sm-6 col-xs-12> < div class =hovereffect> < img class =img-responsivesrc =http://placehold.it/350x200alt => < div class =overlay> < h2>效果10< / h2> < p class =icon-links> < a href =#> < span class =fa fa-twitter>< / span> < / a> < a href =#> < span class =fa fa-facebook>< / span> < / a> < a href =#> < span class =fa fa-instagram>< / span> < / a> < / p> < / div> < / div>< / div>  

解决方案

更改CSS中的 translate 属性:

  .hovereffect .overlay {
width:100%;
position:absolute;
overflow:hidden;
left:0;
top:auto;
bottom:0;
padding:1em;
height:4.75em;
background:#79FAC4;
color:#3c4a50;
-webkit-transition:-webkit-transform 0.35s;
transition:transform 0.35s;
-webkit-transform:translate3d(0,50%,0);
transform:translate3d(0,50%,0);
}

我将上述改为 translate3d %,0); Y(中间)百分比越高,重叠式隐藏的次数越多。



  .hovereffect {width:100%;高度:100%; float:left; overflow:hidden;位置:相对; text-align:center; cursor:default;}。hovereffect .overlay {width:100%; position:absolute; overflow:hidden; left:0; top:auto; bottom:0; padding:1em; height:4.75em;背景:#79FAC4;颜色:#3c4a50; -webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s; -webkit-transform:translate3d(0,50%,0); transform:translate3d(0,50%,0);}。hovereffect img {display:block;位置:相对; -webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s;} hovereffect:hover img {-webkit-transform:translate3d(0,-10%,0); transform:translate3d(0,-10%,0);}。hovereffect h2 {text-transform:uppercase; color:#fff; text-align:center;位置:相对; font-size:17px; padding:10px;背景:rgba(0,0,0,0.6); float:left; margin:0px; display:inline-block;}。hovereffect a.info {display:inline-block; text-decoration:none; padding:7px 14px; text-transform:uppercase; color:#fff; border:1px solid #fff; margin:50px 0 0 0;背景颜色:透明;}。hovereffect a.info:hover {box-shadow:0 0 5px #fff;}。hovereffect p.icon-links a {float:right;颜色:#3c4a50; font-size:1.4em;} hovereffect:hover p.icon-links a:hover,.hovereffect:hover p.icon-links a:focus {color:#252d31;} hovereffect h2,.hovereffect p.icon-链接a {-webkit-transition:-webkit-transform 0.35s; transition:transform 0.35s; -webkit-transform:translate3d(0,200%,0); transform:translate3d(0,200%,0);}。hovereffect p.icon-links a span:before {display:inline-block; padding:8px 10px;英语: -webkit-font-smoothing:antialiased; -moz-osx-font-smoothing:grayscale;} hovereffect:hover .overlay,.hovereffect:hover h2,.hovereffect:hover p.icon-links a {-webkit-transform:translate3d(0,0,0) transform:translate3d(0,0,0);}。hovereffect:hover h2 {-webkit-transition-delay:0.05s; transition-delay:0.05s;} hovereffect:hover p.icon-links a:nth-​​child(3){-webkit-transition-delay:0.1s; transition-delay:0.1s;} hovereffect:hover p.icon-links a:nth-​​child(2){-webkit-transition-delay:0.15s; transition-delay:0.15s;} hovereffect:hover p.icon-links a:first-child {-webkit-transition-delay:0.2s; transition-delay:0.2s;}  

 < div class =col-lg-3 col-md-4 col-sm-6 col-xs-12> < div class =hovereffect> < img class =img-responsivesrc =http://placehold.it/350x200alt => < div class =overlay> < h2>效果10< / h2> < p class =icon-links> < a href =#> < span class =fa fa-twitter>< / span> < / a> < a href =#> < span class =fa fa-facebook>< / span> < / a> < a href =#> < span class =fa fa-instagram>< / span> < / a> < / p> < / div> < / div>< / div>  

I have a image hover effect it hovers well. but i need to be just like the bottom.. as of right now everything is hidden until you hover then it shows... I have tried to modify the margin and padding with no luck

Demo Image Here

    .hovereffect {
    width: 100%;
    height: 100%;
    float: left;
    overflow: hidden;
    position: relative;
    text-align: center;
    cursor: default;
}
.hovereffect .overlay {
    width: 100%;
    position: absolute;
    overflow: hidden;
    left: 0;
	top: auto;
	bottom: 0;
	padding: 1em;
	height: 4.75em;
	background: #79FAC4;
	color: #3c4a50;
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
	-webkit-transform: translate3d(0,100%,0);
	transform: translate3d(0,100%,0);
}

.hovereffect img {
    display: block;
    position: relative;
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
}

.hovereffect:hover img {
-webkit-transform: translate3d(0,-10%,0);
	transform: translate3d(0,-10%,0);
}

.hovereffect h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
	float: left;
	margin: 0px;
	display: inline-block;
}

.hovereffect a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    text-transform: uppercase;
	color: #fff;
	border: 1px solid #fff;
	margin: 50px 0 0 0;
	background-color: transparent;
}
.hovereffect a.info:hover {
    box-shadow: 0 0 5px #fff;
}


.hovereffect p.icon-links a {
	float: right;
	color: #3c4a50;
	font-size: 1.4em;
}

.hovereffect:hover p.icon-links a:hover,
.hovereffect:hover p.icon-links a:focus {
	color: #252d31;
}

.hovereffect h2,
.hovereffect p.icon-links a {
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
	-webkit-transform: translate3d(0,200%,0);
	transform: translate3d(0,200%,0);
}

.hovereffect p.icon-links a span:before {
	display: inline-block;
	padding: 8px 10px;
	speak: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}


.hovereffect:hover .overlay,
.hovereffect:hover h2,
.hovereffect:hover p.icon-links a {
	-webkit-transform: translate3d(0,0,0);
	transform: translate3d(0,0,0);
}

.hovereffect:hover h2 {
	-webkit-transition-delay: 0.05s;
	transition-delay: 0.05s;
}

.hovereffect:hover p.icon-links a:nth-child(3) {
	-webkit-transition-delay: 0.1s;
	transition-delay: 0.1s;
}

.hovereffect:hover p.icon-links a:nth-child(2) {
	-webkit-transition-delay: 0.15s;
	transition-delay: 0.15s;
}

.hovereffect:hover p.icon-links a:first-child {
	-webkit-transition-delay: 0.2s;
	transition-delay: 0.2s;
}

    <div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
    <div class="hovereffect">
        <img class="img-responsive" src="http://placehold.it/350x200" alt="">
            <div class="overlay">
                <h2>Effect 10</h2>
                <p class="icon-links">
                    <a href="#">
                        <span class="fa fa-twitter"></span>
                    </a>
                    <a href="#">
                        <span class="fa fa-facebook"></span>
                    </a>
                    <a href="#">
                        <span class="fa fa-instagram"></span>
                    </a>
                </p>
            </div>
    </div>
</div>

解决方案

Alter the translate properties in the CSS:

.hovereffect .overlay {
    width: 100%;
    position: absolute;
    overflow: hidden;
    left: 0;
    top: auto;
    bottom: 0;
    padding: 1em;
    height: 4.75em;
    background: #79FAC4;
    color: #3c4a50;
    -webkit-transition: -webkit-transform 0.35s;
    transition: transform 0.35s;
    -webkit-transform: translate3d(0,50%,0);
    transform: translate3d(0,50%,0);
}

I changed the above to translate3d(0,50%,0); the higher the Y (middle) percentage, the more the overlay is hidden.

.hovereffect {
    width: 100%;
    height: 100%;
    float: left;
    overflow: hidden;
    position: relative;
    text-align: center;
    cursor: default;
}
.hovereffect .overlay {
    width: 100%;
    position: absolute;
    overflow: hidden;
    left: 0;
	top: auto;
	bottom: 0;
	padding: 1em;
	height: 4.75em;
	background: #79FAC4;
	color: #3c4a50;
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
	-webkit-transform: translate3d(0,50%,0);
	transform: translate3d(0,50%,0);
}

.hovereffect img {
    display: block;
    position: relative;
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
}

.hovereffect:hover img {
-webkit-transform: translate3d(0,-10%,0);
	transform: translate3d(0,-10%,0);
}

.hovereffect h2 {
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    position: relative;
    font-size: 17px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.6);
	float: left;
	margin: 0px;
	display: inline-block;
}

.hovereffect a.info {
    display: inline-block;
    text-decoration: none;
    padding: 7px 14px;
    text-transform: uppercase;
	color: #fff;
	border: 1px solid #fff;
	margin: 50px 0 0 0;
	background-color: transparent;
}
.hovereffect a.info:hover {
    box-shadow: 0 0 5px #fff;
}


.hovereffect p.icon-links a {
	float: right;
	color: #3c4a50;
	font-size: 1.4em;
}

.hovereffect:hover p.icon-links a:hover,
.hovereffect:hover p.icon-links a:focus {
	color: #252d31;
}

.hovereffect h2,
.hovereffect p.icon-links a {
	-webkit-transition: -webkit-transform 0.35s;
	transition: transform 0.35s;
	-webkit-transform: translate3d(0,200%,0);
	transform: translate3d(0,200%,0);
}

.hovereffect p.icon-links a span:before {
	display: inline-block;
	padding: 8px 10px;
	speak: none;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}


.hovereffect:hover .overlay,
.hovereffect:hover h2,
.hovereffect:hover p.icon-links a {
	-webkit-transform: translate3d(0,0,0);
	transform: translate3d(0,0,0);
}

.hovereffect:hover h2 {
	-webkit-transition-delay: 0.05s;
	transition-delay: 0.05s;
}

.hovereffect:hover p.icon-links a:nth-child(3) {
	-webkit-transition-delay: 0.1s;
	transition-delay: 0.1s;
}

.hovereffect:hover p.icon-links a:nth-child(2) {
	-webkit-transition-delay: 0.15s;
	transition-delay: 0.15s;
}

.hovereffect:hover p.icon-links a:first-child {
	-webkit-transition-delay: 0.2s;
	transition-delay: 0.2s;
}

<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12">
    <div class="hovereffect">
        <img class="img-responsive" src="http://placehold.it/350x200" alt="">
            <div class="overlay">
                <h2>Effect 10</h2>
                <p class="icon-links">
                    <a href="#">
                        <span class="fa fa-twitter"></span>
                    </a>
                    <a href="#">
                        <span class="fa fa-facebook"></span>
                    </a>
                    <a href="#">
                        <span class="fa fa-instagram"></span>
                    </a>
                </p>
            </div>
    </div>
</div>

这篇关于图像悬停效果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆