wordpress - 如何更改 featherlight.js Wordpress 插件的默认值?
问题描述
当使用 featherlight 作为 wordpress 插件时,如何在不破坏主题等的情况下更改默认选项?
我看到我页面上加载的唯一 js 是
/wp-content/plugins/wp-featherlight/js/wpFeatherlight.pkgd.min.js?ver=1.3.0
目前我需要将所有这些属性添加到每个链接:
data-featherlight="iframe"
data-featherlight-iframe-frameborder="0"
data-featherlight-iframe-allow="autoplay; encrypted-media"
data-featherlight-iframe-allowfullscreen="true"
data-featherlight-iframe-style="position:fixed;background:#000;border:none;top:0;right:0;bottom:0;left:0;width:100%;height:100%;"
...这是很多重复的开销。如何将这些设置为所有 iframe 灯箱的默认值?
解决方案
您可以像这样全局设置默认值:
$.extend($.featherlight.defaults, {
type: "iframe",
iframeFrameborder: "0",
iframeAllow: "autoplay; encrypted-media",
iframeAllowfullscreen: "true",
iframeStyle: "position:fixed;background:#000;border:none;top:0;right:0;bottom:0;left:0;width:100%;height:100%;",
});
推荐阅读
- javascript - 将数据从 Vue 组件传递到 Vuex 存储
- machine-learning - 在 sklearn 方法中更改 random_state(在调整超参数之后)提供不同的准确性
- symfony - ORO 平台 - 如何将相关实体的集合传递给 datagrid 列模板?
- java - 如何检测 Canvas 尺寸是否对于图形系统来说太大?
- python - SciPy 差分进化:即使工人 = -1 也不能在多核上运行
- amazon-web-services - 如何将根域重定向到 AWS route53 中的子域?
- oracle - 带有 LDAP 的 Oracle JDBC-URL 到 OLE DB 连接字符串 - 如何?
- python - 在类变量python中使用类方法
- react-native-ios - Expo SDK 38 错误:“AR 模块已从 expo 包中删除”,即使没有使用 AR 模块
- javascript - JavaScript 文本未显示