【问题标题】:Linking an <img class> image to a URL - working fine in safari and chrome but not in Firefox将 <img class> 图像链接到 URL - 在 safari 和 chrome 中工作正常,但在 Firefox 中不能
【发布时间】:2017-03-15 14:19:00
【问题描述】:

我正在处理这个页面:

http://doitanyway.dk/intelligentsystems/en/homeuk/

滑块下方有 6 张图片,带有一些分层悬停效果。在 Safari、Chrome 和 Opera 中,一切都像魅力一样运行 - 但在 Firefox(和 Tor)中却不是。

问题似乎是围绕 img 类的“a href”。它在我的 mac Firefox 52.0 中不起作用。有谁知道解决方法...?

这是第一张图片的代码:

HTML

<div class="width: 130px">
<div class="hovereffect">
<a href="http://doitanyway.dk/intelligentsystems/en/healthcare/">
<img class="img-responsive" src="http://doitanyway.dk/intelligentsystems/wp-content/uploads/2017/03/submenu_front1.png" alt="">
</a>
<div class="overlay">
<h2>Healthcare</h2>
<p>
<a href="http://doitanyway.dk/intelligentsystems/en/healthcare/">See our solutions</a>
</p>
</div>
</div>
</div>

CSS

  .hovereffect {
  width: 100%;
  height: 100%;
  float: left;
  overflow: hidden;
  position: relative;
  text-align: center;
  cursor: default;
  background: #000000;
  border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
}

.hovereffect .overlay {
pointer-events: none;
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
  top: 0;
  left: 0;
  padding: 129px 10px;
  border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
}

.hovereffect img {
  display: block;
  position: relative;
  -webkit-filter: sepia(50%); /* Safari */
  filter: sepia(50%);
  max-width: none;
  /* width: calc(100% + 20px);  */
  -webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
  transition: opacity 0.7s, transform 0.7s;
  /* -webkit-transform: translate3d(-10px,0,0); */
   /* transform: translate3d(-10px,0,0); */
  -webkit-backface-visibility: hidden; 
  backface-visibility: hidden;
  border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
}

.hovereffect:hover img {
pointer-events: none;
  border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
  opacity: 0.4;
  filter: alpha(opacity=40);
  -webkit-transform: translate3d(0,0,0);
  transform: translate3d(0,0,0);
  border-radius: 10px !important;
  -moz-border-radius: 10px !important;
  -webkit-border-radius: 10px !important;
}

.hovereffect h2 {
 /*  text-transform: uppercase; */
  color: #fff;
  text-align: center;
  position: relative;
  font-size: 11px;
  overflow: hidden;
  padding: 0.5em 0;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 8px;
}

.hovereffect h2:after {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: #fff;
  content: '';
  -webkit-transition: -webkit-transform 0.35s;
  transition: transform 0.35s;
  -webkit-transform: translate3d(-100%,0,0);
  transform: translate3d(-100%,0,0);
}

.hovereffect:hover h2 {
  -webkit-transform: translate3d(0,0,0);
  transform: translate3d(0,0,0);
  text-shadow: none;
  background: rgba(0, 0, 0, 0);
}

.hovereffect:hover h2:after {
  -webkit-transform: translate3d(0,0,0);
  transform: translate3d(0,0,0);
}

.hovereffect a, .hovereffect p {
  color: #FFF;
  opacity: 0;
  filter: alpha(opacity=0);
  -webkit-transition: opacity 0.35s, -webkit-transform 0.35s;
  transition: opacity 0.35s, transform 0.35s;
  -webkit-transform: translate3d(100%,0,0);
  transform: translate3d(100%,0,0);
  font-size: 10px;
}

.hovereffect:hover a, .hovereffect:hover p {
  opacity: 1 !important;
  filter: alpha(opacity=100);
  -webkit-transform: translate3d(0,0,0);
  transform: translate3d(0,0,0);
  font-size: 10px;
}

【问题讨论】:

    标签: javascript html css class firefox


    【解决方案1】:

    删除以下css规则。

    .hovereffect a, .hovereffect p {不透明度:0}

    【讨论】:

    • 你说得对,它没用。虽然它并没有解决我的问题。仍然无法在 Firefox 中运行。
    • 在沮丧中,我一定是添加了一些让事情变得更糟的东西:-/我试图从几天前恢复我的 css 副本。在删除 .hovereffect a, .hovereffect p {opacity:0} 后一切正常。谢谢一堆!!!
    【解决方案2】:

    哪个 Firefox 版本无法运行?它正在为我开发 FF 51。 这些属性可能不受支持,或者您可能需要为所有转换添加额外的 -moz- 规则。 在此处查看支持:http://caniuse.com/#search=transform

    【讨论】:

    • 我现在在 mac FF 52 上,但它不工作。问题似乎出在 html - "a href" 环绕 img 类。有人知道解决方法吗...?
    猜你喜欢
    • 2013-12-27
    • 1970-01-01
    • 1970-01-01
    • 2016-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-11
    相关资源
    最近更新 更多