【问题标题】:anchor tag is not working on image hover effect锚标记不适用于图像悬停效果
【发布时间】:2016-10-05 22:43:27
【问题描述】:

带有链接 href 的锚标记现在无法显示可点击

/****** PLACE YOUR CUSTOM STYLES HERE ******/

.gridpb {
    padding-bottom: 24px
}

.hovereffect {
  width: 100%;
  height: 100%;
  float: left;
  overflow: hidden;
  position: relative;
  text-align: center;
  cursor: default;
}

.hovereffect .overlay {
  width: 100%;
  height: 100%;
  position: absolute;
  overflow: hidden;
  top: 0;
  left: 0;
}

.hovereffect img {
  display: block;
  position: relative;
  -webkit-transition: all 0.4s ease-in;
  transition: all 0.4s ease-in;
}

.hovereffect:hover img {
  filter: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg"><filter id="filter"><feColorMatrix type="matrix" color-interpolation-filters="sRGB" values="0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0" /><feGaussianBlur stdDeviation="3" /></filter></svg>#filter');
  filter: grayscale(1) blur(3px);
  -webkit-filter: grayscale(1) blur(3px);
  -webkit-transform: scale(1.2);
  -ms-transform: scale(1.2);
  transform: scale(1.2);
}

.hovereffect h2 {
  text-transform: uppercase;
  text-align: center;
  position: relative;
  font-size: 17px;
  padding: 10px;
  background: rgba(0, 0, 0, 0);
}

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

.hovereffect a.info:hover {
  box-shadow: 0 0 5px #fff;
}

.hovereffect a.info, .hovereffect h2 {
  -webkit-transform: scale(0.7);
  -ms-transform: scale(0.7);
  transform: scale(0.7);
  -webkit-transition: all 0.4s ease-in;
  transition: all 0.4s ease-in;
  opacity: 0;
  filter: alpha(opacity=0);
  color: #fff;
  text-transform: uppercase;
}

.hovereffect:hover a.info, .hovereffect:hover h2 {
  opacity: 1;
  filter: alpha(opacity=100);
  -webkit-transform: scale(1);
  -ms-transform: scale(1);
  transform: scale(1);
}
    <div class="col-sm-4 gridpb">
                     <div class="hovereffect">
                     <img src="http://www.gettyimages.pt/gi-resources/images/Homepage/Hero/PT/PT_hero_42_153645159.jpg" />
                     <div class="overlay">
                     <h2>Scientific Funk - 1988 EP</h2>
                <a class="info" href="https://www.beatport.com/release/1988-ep/1577944" target="_blank" >Buy on Beatport</a>
                                </div>
                            </div>
                        </div>
                          

带有链接 href 的锚标记现在无法显示可点击

<div class="col-sm-4 gridpb">
  <div class="hovereffect">
    <img src="img/8.jpg" />
    <div class="overlay">
      <h2>Scientific Funk - 1988 EP</h2>
      <a class="info" href="https://www.beatport.com/release/1988-ep/1577944" target="_blank">Buy on Beatport</a>
    </div>
  </div>
</div>

锚标签在悬停效果之外正常工作,但不在内部,我想要在里面

【问题讨论】:

  • BUY ON BEATPORT 按钮有锚标签的链接,但它没有指向锚标签中给出的链接
  • @hasni 单击按钮后,您是否在控制台中收到“混合内容”警告消息?
  • 实际上它在我这边是不可点击的,我也没有在控制台中收到任何警告
  • 如果我们把这个锚标签放在 hove 效果 div 之外,它就可以工作了
  • @hasni Strange.. 我已将您的代码完全复制到 jsfiddle,它似乎有效:jsfiddle.net/C0dekid/fzjq47ba

标签: html css


【解决方案1】:

这实际上不是您的代码的问题。 stackoverflow 代码 sn-p 是在此页面中运行的 iframe,可防止在浏览器中打开新的父窗口。我刚刚将您的代码复制到了这个运行良好的 JSFiddle!

只需在我的 JSFiddle 上查看您的代码here。

<div class="col-sm-4 gridpb">
                 <div class="hovereffect">
                 <img src="http://www.gettyimages.pt/gi-resources/images/Homepage/Hero/PT/PT_hero_42_153645159.jpg" />
                 <div class="overlay">
                 <h2>Scientific Funk - 1988 EP</h2>
            <a class="info" href="https://www.beatport.com/release/1988-ep/1577944" target="_blank" >Buy on Beatport</a>
                            </div>
                        </div>
                    </div>

【讨论】:

    【解决方案2】:

    在你的问题中 如果你删除 target ="_blank" 那么它工作成功

    问题是 target="_blank" 不起作用,如果您需要帮助,请拒绝此链接 click here

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-10
      • 1970-01-01
      • 1970-01-01
      • 2020-08-08
      相关资源
      最近更新 更多