【问题标题】:How to disable ngx-bootstrap modal animation?如何禁用 ngx-bootstrap 模态动画?
【发布时间】:2018-11-10 21:36:46
【问题描述】:

有没有办法禁用ngx-bootstrap modal 的动画?

我已尝试添加此配置,但无法正常工作:

config = {
  animated: false,
  backdrop: 'static'
};

演示:

https://stackblitz.com/edit/ngx-bootstrap-cwfhnu?file=app%2Fmodal-component%2Fstatic-modal.component.html

模态框仍然显示动画。

因为在某些情况下,当在更复杂的网页中使用模式时(例如单击后 2 秒),模式显示速度非常慢,因此禁用动画可能会更好。

【问题讨论】:

标签: angular animation ngx-bootstrap ngx-bootstrap-modal disable


【解决方案1】:

现在您只能在使用 BsModalService 时禁用动画。

以下是它的用法示例:

https://stackblitz.com/edit/ngx-bootstrap-k25ywj?file=app/app.component.ts

this.modalService.show(template, {
   animated: false
});

【讨论】:

  • ng-template modals 在实际应用中没有用处,无法为它们添加任何自定义 css 样式,文档非常有限。
  • 如果您需要一些 lib 未提供的功能,请联系 ngx-bootstrap 团队并提出要求。 Slack - ngx-slack.herokuapp.com Github - github.com/valor-software/ngx-bootstrap
  • 是否也可以从模板中禁用动画?
猜你喜欢
  • 1970-01-01
  • 2018-04-04
  • 2019-12-01
  • 2018-08-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-09-03
相关资源
最近更新 更多