Skip to content

Instantly share code, notes, and snippets.

@mqxu
Created November 3, 2019 12:08
Show Gist options
  • Save mqxu/cb8a698815aa9b6479111c176a79660c to your computer and use it in GitHub Desktop.
Save mqxu/cb8a698815aa9b6479111c176a79660c to your computer and use it in GitHub Desktop.
【iCSS:行为】使用pointer-events禁用事件触发
<div class="bruce flex-ct-x">
<a class="disabled-trigger" href="https://www.baidu.com">点我</a>
</div>
document.getElementsByClassName("disabled-trigger")[0].addEventListener("click", () => alert("Hello World"));
.disabled-trigger {
padding: 0 20px;
border-radius: 10px;
height: 40px;
background-color: #66f;
pointer-events: none;
line-height: 40px;
color: #fff;
}
<link href="https://yangzw.vip/static/css/reset.css" rel="stylesheet" />
<link href="https://yangzw.vip/static/css/main.css" rel="stylesheet" />
<link href="https://yangzw.vip/static/css/theme.scss" rel="stylesheet" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment