Carousal - 显示项目高度动态

时间:2017-08-17 11:09:54

标签: javascript html css html5 carousel

我正在使用GlideJS来展示一个转盘。问题是每个项目自动获取具有最多内容的项目的高度。这会导致内容较少的项目之间的空白区域以及跟随之后的HTML元素。 为了说明这个问题,我创建了以下小提琴:

https://jsfiddle.net/thx03jc7/38/

<div class="module module--horizontal">
  <div id="Carousel" class="glide">
   please see the above Fiddle for full code example
  </div>
</div>

如何使每个项目的高度动态化,从而消除转盘后跟随的项目和HTML元素之间的空白区域?

2 个答案:

答案 0 :(得分:1)

您可以使用autoheight属性:

guard let filePath = Bundle.main.path(forResource: "FL_insurance_sample", ofType: "csv") else {
    print("No such file in bundle")
    // handle situation
    return
}
guard let fileData = FileManager.default.contents(atPath: filePath) else {
    print("Can't read file")
    // handle situation
    return
}
// upload fileData

所有选项:http://glide.jedrzejchalubek.com/docs.html#options

答案 1 :(得分:0)

如果你将文字包装在div中的另一个.box内(就像小提琴中的第一个项目一样),你可以添加以下css

.box > div{
   height: 200px; //or whatever height you wish
 }

here's the updated fiddle

相关问题