【问题标题】:ngx-gallery width and height options missingngx-gallery 宽度和高度选项缺失
【发布时间】:2020-06-27 16:52:28
【问题描述】:

我想知道,如何给 ngx-gallery (https://github.com/MurhafSousli/ngx-gallery) 一个新的高度。它有一个 500px 的固定值,改变父 div 的高度并没有改变任何东西。

我正在寻找模板中的一些属性,像这样

<gallery
   [height] = '250px'>
</gallery>

Stackblitz:https://stackblitz.com/edit/angular-osh1vu

后续问题:在 Stackblitz 中,行为是适合高度(关于黑色背景),而在我的应用程序中,它是适合宽度,因此黑色条纹位于图像上方和下方。我怎么能改变这个呢? (这在旧版本上是可能的,但不再是有效属性)

或

一些 css 代码(在开发工具中查看,滑动图像标记为 div.g-template.g-item-template),也无法覆盖:

div.g-template.g-item-template {
  height: 200px !important;
}

【问题讨论】:

  • 你是把这个 css 代码放在 style.css 而不是组件 css 中吗?
  • 我都试过了,似乎创建了一些新的css-box实例,较小的版本向左滑动,超出了视口
  • 我添加了答案@connectedMind 检查它

标签: css angular ngx-gallery


【解决方案1】:

Demo 为图库元素添加类

<div class="basic-container">
    <h2>Gallery component</h2>
    <gallery class="custom"
    [items]="items"
    [dots]=true
    [thumb]=false
    [loop]=false
    [playerInterval] = 5000
    [autoPlay]=true
    [loadingStrategy]=preload>
  </gallery>
</div>

在css中改变

.custom{
height:200px;
}

【讨论】:

  • 是的,看起来我没有尝试过这种简单的可能性,画廊 { height: 200px } 也可以工作...应该多睡觉 :)
猜你喜欢
  • 1970-01-01
  • 2018-03-27
  • 1970-01-01
  • 1970-01-01
  • 2022-01-09
  • 1970-01-01
  • 2011-10-19
  • 2015-02-15
  • 1970-01-01
相关资源
最近更新 更多