指针事件:没有一个不起作用 [英] pointer-events: none is not working

查看:52
本文介绍了指针事件:没有一个不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个制作可点击卡片的Web应用程序.我想为零机会禁用锚标记上的click事件.

I am creating a web application where I made a clickable card. I want to disable the click event on anchor tag for zero Opportunities.

但是pointer-events: none;无法正常工作.

我在此处设置了一个代码段,以便于更好地理解.

I have setup a snippet here for better understanding.

.fc-card-header {
    background: #1976d2;
    padding: 24px;
    height: auto;
    border-radius: 3px;
    display: block;
}
.svg-icon svg {
    width: 24px;
    height: 24px;
    fill: rgba(0,0,0,0.54);
}

<a href="cmOpportunitySummary" class="white" style="text-decoration:none;pointer-events: none; cursor: default;;">
<div class="fc-card-header">
    <div class="grid-row">
        <div class="grid-cell text-left no-padding padding-right cell-auto-width">
            <div class="svg-icon no-width no-padding white" data-role="ico_RoundStar"><svg viewBox="0 0 24 24"><path d="M0 0h24v24H0z" fill="none"></path> <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"></path></svg></div>
        </div>
        <div class="grid-cell no-padding flex flex-vcenter">
            <p class="text-left white">Opportunities</p>
        </div>
    </div>
    <div class="grid-row padding-top">
        <div class="grid-cell no-padding padding-top padding-bottom text-left flex flex-vcenter">
            <span class="heading white no-line-height">0</span>
        </div>
    </div>
</div>
</a>

推荐答案

a标记上使用display:block;display:inline-block;,它将起作用.

Use display:block; or display:inline-block; on a tag, it will work.

a {
  text-decoration: none;
  pointer-events: none;
  cursor: default;
  display: block;
  color: #fff;
}
.fc-card-header {
  background: #1976d2;
  padding: 24px;
  height: auto;
  border-radius: 3px;
  display: block;
}
.svg-icon svg {
  width: 24px;
  height: 24px;
  fill: rgba(0, 0, 0, 0.54);
}

<a href="cmOpportunitySummary" class="white">
  <div class="fc-card-header">
    <div class="grid-row">
      <div class="grid-cell text-left no-padding padding-right cell-auto-width">
        <div class="svg-icon no-width no-padding white" data-role="ico_RoundStar">
          <svg viewBox="0 0 24 24">
            <path d="M0 0h24v24H0z" fill="none"></path>
            <path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"></path>
          </svg>
        </div>
      </div>
      <div class="grid-cell no-padding flex flex-vcenter">
        <p class="text-left white">Opportunities</p>
      </div>
    </div>
    <div class="grid-row padding-top">
      <div class="grid-cell no-padding padding-top padding-bottom text-left flex flex-vcenter">
        <span class="heading white no-line-height">0</span>
      </div>
    </div>
  </div>
</a>

这篇关于指针事件:没有一个不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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