如何修复悬停弹出?

How to fix popping on hover?

希望你一切都好。 如何修复图像悬停时弹出的问题? 我需要它慢慢变大。如您所见,大图逐渐消失。

我附上了一个很好的例子来解释这一点。

如有任何帮助,我们将不胜感激。谢谢 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>

主要问题是缩放应用于当前悬停的图像,由于悬停时 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 blur filter:

/*......... 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>

仅使用一张图片并且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>