【发布时间】:2019-08-30 07:45:55
【问题描述】:
fancybox 脚本的以下摘录在 jquery 3.3.1 下不起作用。它适用于 jquery 1.11.0。
如果没有 removeAttribute,您将如何重写此语句,这被报告为不是函数?
a.support.opacity ||
(p.get(0).style.removeAttribute("filter"),
f.get(0).style.removeAttribute("filter"));
【问题讨论】:
-
您是在寻找removeProperty 吗?
-
我不知道 removeProperty 或 removeAttr 是否合适。但是这里的每个答案:stackoverflow.com/questions/14344289/…(朝向页面底部)必须替换该属性。我只是不明白他是如何处理语法的。
-
假设
a是一个jQuery 对象,那么问题是support的使用。文档建议改用 Modernizr 进行特征检测。 -
为什么不升级到最新版本的fancybox?
-
为什么你认为
removeAttribute在 jquery 中被弃用了?这不是 jquery 方法,因为您使用了.get(0).style(developer.mozilla.org/en-US/docs/Web/API/Element/…
标签: javascript jquery fancybox backwards-compatibility