gpt4 book ai didi

css - 指针事件:没有在 IE 中不起作用

转载 作者:技术小花猫 更新时间:2023-10-29 11:42:05 26 4
gpt4 key购买 nike

我正在尝试禁用 SharePoint 2013 列表编辑页面中的超链接。我使用了一个内容编辑器 webpart 并放置了 pointer-events : none。它在 Google Chrome 上运行良好,但在 IE 中不起作用。还有其他选择吗?我只想要 CSS 替代方案。我的 IE 是版本 10。

最佳答案

pointer-events 在 IE 10 中不受支持,并且没有其他类似的 CSS 属性。

需要更改标记或使用脚本来解决该问题。

更新

这是一个使用脚本的示例。

我还设计了链接的样式,所以人们看不到它们是链接,实际上可以单独使用,基于如果有人随机点击文本并且不小心点击了一个,它仍然可以。

Array.prototype.slice.call(document.querySelectorAll("a")).forEach(function(link) {
link.addEventListener("click", function(e) {
e.preventDefault();
});
});
a {
cursor: text;
text-decoration: none;
color: inherit;
}
Some text with <a href="http://stackoverflow.com"> a link </a> to click on

更新 2

这里实际上有 2 个帖子,其中有几种方法可以完成此操作(除了一个之外都是脚本),

哪里this answer不使用脚本。


根据评论更新 3

使用属性 disabled='disabled'要么需要在服务器端添加它,这样 anchor 看起来像这样,<a href="link" disabled="disabled">Link</a> , 或者客户端有这样的脚本

Array.prototype.slice.call(document.querySelectorAll("a")).forEach(function(link) {

link.setAttribute('disabled', 'disabled');

});
/*
a {
cursor: text;
text-decoration: none;
color: inherit;
}
*/
Some text with <a href="http://stackoverflow.com"> a link </a> to click on

关于css - 指针事件:没有在 IE 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35885291/

26 4 0
文章推荐: python - 关闭 Python 守护进程时运行代码
文章推荐: html -
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com