Susy gallery with AngularJS (ng-repeat) - 不填补 ng-hide 的空白
Susy gallery with AngularJS (ng-repeat) - not filling gaps from ng-hide
我正在使用Susy的图库工具以网格格式显示元素。Angular 会动态隐藏或显示这些网格元素,具体取决于用户的选择。当 Angular 在网格中隐藏元素时,它会向其附加一类ng-hide
。这反过来将其 CSS 设置为 display:none !important
。
问题是 Susy 正在计算每个元素的位置,而不考虑设置为display:none
的项目 - 当这些元素被隐藏时,它会在网格中留下间隙。
有没有可能让苏茜在布置隐藏元素时忽略它们?
我尝试使用:not()
CSS选择器,但没有成功 - 布局中仍然存在差距:
.results__result:not(.ng-hide) {
@include gallery(3 of 12);
}
Sass 对 DOM 一无所知,所以 Susy 也不知道。要创建图库布局,susy 必须依靠nth-child
选择器——这对于您正在谈论的用例效果不佳。从简单开始:
.results__result {
@include span(3 of 12);
}
如果你使用的是split
、inside
或inside-static
排水沟——这应该可以工作。否则,您需要某种方法来定位网格每一行中的last
元素。CSS 没有办法定位第 n 个可见,因此这需要在标记/js 中添加逻辑。给定每 4 个可见结果一个last
类,您可以添加:
.last {
@include last;
}
相关文章:
- 使用angularjs ng Show/ng hide显示和隐藏不同的内容
- 我需要NG-IF/NG-SWITCH还是NG-SHOW&NG-HIDE
- 使用ng-hide根据条件显示/隐藏按钮
- ng show和ng hide don'I don’我一秒钟都不工作
- 使用 ng-hide 切换表中的列,其中 colRessize 可调整大小
- 实时 Angular js ng-hide 不起作用
- AngularJS:隐藏<td>使用ng-hide/ng-show没有间隙
- 使ng-show/ng-hide与由Angular之外的外部源修改的localStorage一起工作
- 是否可以使用相同的变量使ng if的行为类似于ng show/ng hide
- angular ng show/ng hide无法正确使用ng bind html
- ng-hide 元素出现一段时间,然后隐藏
- ng-show / ng-hide / ng-if 不适用于 Angular 指令
- 切换 标记在使用 ng-hide/show 和布尔值时失败
- AngularJS ng-hide in nested dictionary
- 不要在窗体序列化时将元素包含在 ng-hide 中
- ng-hide and ng-show without Javascript
- angularjs $index when ng-hide with ng-repeat
- AngularJS在使用ng-show ng-hide时,我仍然看到这两个对象1ms
- Angular js ng-show and ng-hide with animation using toggle c
- Susy gallery with AngularJS (ng-repeat) - 不填补 ng-hide 的空白