1

hope you are all well. How do i fix the popping on image hover? I need it to slowly go large. as you can see the large image just fades.

I have attached a nice example to explain this more.enter image description here

Any help would be grateful here. Thx yummi

/*............ right-column ............*/

.right-column {
  position: absolute;
}


/*......... crossfade on buttons .........*/

#hover img {
  -o-transition: .3s;
  -ms-transition: .3s;
  -moz-transition: .3s;
  -webkit-transition: .3s;
  position: absolute;
}

.nohover {
  opacity: 0;
}

a:hover .hover {
  opacity: 0;
}

a:hover .nohover {
  opacity: 1;
}


/*................ bevels ................*/

img.bevel {
  border-radius: 20px;
}

img#bevel {
  border-radius: 20px;
}


/*............. pop on hover .............*/

#pop img {
  transition: .5s ease
}

#pop img:hover {
  -webkit-transform: scale(1.15);
  -ms-transform: scale(1.15);
  transform: scale(1.15);
  transition: 0.5s ease;
}
<div class="right-column" id="pop" align="center">
  <div>
    <a id="hover" href="gallery.html"><img src="http://wizzfree.com/pix/vid0.jpg" width="120" id="bevel" class="nohover"><img src="http://wizzfree.com/pix/vid0b.jpg" width="120" id="bevel" class="hover"></a>
  </div>

4

2 回答 2

1

主要问题是比例应用于当前悬停的图像,由于opacity: 0悬停而消失。

变换和scale过渡应适用于a#hover.

注意:我已经清理了你的 CSS。除非您需要支持非常旧的浏览器,否则不需要浏览器前缀进行转换和转换。在添加前缀之前检查您的目标浏览器。

/*......... crossfade on buttons .........*/

.hover img {
  position: absolute;
  transition: all 0.5s ease;
}

.nohover {
  opacity: 0;
}

.hover:hover img {
  transform: scale(1.15);
}

.hover:hover .hover {
  opacity: 0;
}

.hover:hover .nohover {
  opacity: 1;
}

/*................ bevels ................*/

.bevel {
  border-radius: 20px;
}
<a class="hover" href="gallery.html">
  <img src="http://wizzfree.com/pix/vid0.jpg" width="120" class="nohover bevel">
  <img src="http://wizzfree.com/pix/vid0b.jpg" width="120" class="hover bevel">
</a>

如果不需要支持 IE,单张图片也可以达到同样的效果,加上CSS 模糊滤镜

/*......... crossfade on buttons .........*/

.hover img {
  position: absolute;
  transition: all 0.5s ease;
  filter: blur(3px);
}

.hover:hover img {
  transform: scale(1.15);
  filter: blur(0);
}

/*................ bevels ................*/

.bevel {
  border-radius: 20px;
}
<a class="hover" href="gallery.html">
  <img src="http://wizzfree.com/pix/vid0.jpg" width="120" class="bevel">
</a>

于 2020-09-22T21:13:49.757 回答
1

仅使用一张图片和 CSS filter

.btnImg {
  display: inline-block;
  width: 120px; height: 80px;
  border-radius: 20px;
  overflow: hidden;
  transition: transform .3s;
}
.btnImg img {
  width: inherit; height: inherit;
  object-fit: cover;
  transition: filter .3s;
  transform: scale(1.05);
  filter: blur(3px);
  backface-visibility: hidden;
}
.btnImg:hover {
  transform: scale(1.16);
}
.btnImg:hover img {
  filter: blur(0);
}
<a class="btnImg" href="gallery.html">
  <img src="http://wizzfree.com/pix/vid0.jpg">
</a>

于 2020-09-22T21:26:15.030 回答