简体   繁体   English

如何在Featherlight中覆盖默认设置?

[英]How do I override defaults settings in featherlight?

Featherlight works with no problems but I cannot figure out how to override defaults settings. Featherlight可以正常工作,但是我无法弄清楚如何覆盖默认设置。

I read the documentation, but everything I try does not seems to work. 我阅读了文档,但是我尝试执行的所有操作似乎均无效。 For example, if I want to change openSpeed , what should I write? 例如,如果我想更改openSpeed ,我应该写什么? I am not using the gallery. 我不在使用画廊。

Featherlight configuration docs . Featherlight配置文档

Just modify properties of $.featherlight.defaults , like this: 只需修改$.featherlight.defaults属性,如下所示:

$.featherlight.defaults.openSpeed = 500;

As @Marc-AndréLafortune pointed, you can override multiple options using $.extend() , like that: 正如@Marc-AndréLafortune指出的那样,您可以使用$.extend()覆盖多个选项,如下所示:

$.extend($.featherlight.defaults, {
  openSpeed: 1000,
  closeSpeed: 1000
});

You can change the default globally with 您可以使用

$.featherlight.defaults.openSpeed = 1000

For multiple settings, you can of course use: 对于多种设置,您当然可以使用:

$.extend($.featherlight.defaults, {
  openSpeed: 1000,
  closeSpeed: 1000
});

Just don't replace the defaults by a different object altogether. 只是不要完全用其他对象替换默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM