当使用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灯箱的这些设置为默认值?
答案 0 :(得分:0)
您可以像这样全局设置默认值:
$.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%;",
});