简体   繁体   English

如何使用Foundation-apps使块流动

[英]How to make blocks flow with Foundation-apps

I'm using Foundation-Apps in am html page where I want to display a series of blocks (unknown number) in rows of four. 我在html页面中使用Foundation-Apps,我想在其中以四行显示一系列块(未知数字)。

That much I've managed: 我已经管理了这么多:

<div class="grid-block small-up-4">
  <div ng-repeat="thing in vm.collection"  class="grid-content">
      <myDirective thing="thing" expanded="false"/>
  </div>
</div>

Now the problem is that I need to allow each of the blocks rendered (by myDirective) to be horizontally expandable and when it expands for it to be the only block on that row. 现在的问题是,我需要允许(由myDirective渲染)的每个块都可以水平扩展,并且当它扩展时,它是该行上的唯一块。

I tried removing the small-up-4 (which as I understand means split the next element into 4 and size children accordingly) and toggling size classes on the out of my directive (ie use small-3 when 4 columns or small-12 when expanded and should take up a full row) but I only seem to be able to get either a single block on a row, or 4 blocks and their internal size changing as I set the second content to be visible. 我尝试删除了small-up-4(据我所知,这意味着将下一个元素分成4个,并相应地将子元素的大小)并在我的指令之外切换size类(即,在4列时使用small-3,而在4列时使用small-12)展开并应占据一整行),但我似乎只能在一行中获得一个块,或者只能获得4个块,并且随着我将第二个内容设置为可见,它们的内部大小也会发生变化。

myDirective outputs something like this: myDirective输出如下内容:

<div class-"grid-block">
  <div class="card" class="{{vm.expanded?'small-3':'small-12'}}">
  ....
  </div>
  <div ng-if="vm.expanded" class="card small-9">
    ....
  </div>
</div>

The vm.expanded bit is working ok both in directive and adding/removing classes. vm.expanded位在指令和添加/删除类中都可以正常工作。 This is a Foundation thing, not Angular. 这是基金会的事情,不是Angular。

How can I achieve this? 我该如何实现? Expanding element takes up a whole row while other blocks stay same size and flow to next row? 扩展元素占据整行,而其他块保持相同大小并流到下一行?

Looking at the most recent documentation for version 1.2 you should be using the "wrap" class instead of "small-up-4" in the top level div. 查看1.2版的最新文档,您应该在顶层div中使用“ wrap”类而不是“ small-up-4”。 This will wrap any grid-block that doesn't fit in the current row anymore. 这将包装所有不再适合当前行的网格块。

Haven't tried it though. 还没有尝试过。

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

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