strange behaviors of masonry grid
See original GitHub issueHello!
I would like to report some strange behaviors of masonry grid. Also I would contribute on the library if you are okay with this.
- Sometimes grid gets lost its column count to 1 and never get recovered until I refresh the page https://drive.google.com/open?id=15m5UkzDATY_GLsPpZ0_Zw8IYOEc-ZD-4
- Sometimes items are overlapped. They are not being displayed. It only happens on the first column https://drive.google.com/file/d/1umLm6pacTwylzr2GWomrHH6zdTkl0LBo/view
Here goes my implementation
<ngx-masonry class="my-50" [options]="{gutter: gutter}" (layoutComplete)="layoutCompleted($event)">
<div ngxMasonryItem class="masonry-item" *ngFor="let idea of ideas"
[style.width]="cardWidth"
[style.margin-bottom.px]="gutter">
<job-hub-idea-board-card [editable]="editable"
[selectable]="selectable"
[clickable]="clickable"
[idea]="idea"
[isCustomer]="isCustomer"
(view)="view($event)"
(edit)="edit.emit($event)"
(delete)="delete.emit($event)"></job-hub-idea-board-card>
</div>
</ngx-masonry>
<p class="d-flex align-items-center justify-content-center text-primary" *ngIf="hasPending">Loading
{{ ideas.length > loaded ? ideas.length - loaded : loaded - ideas.length }} more images...
<span class="d-inline-block ml-10 px-10 py-10 position-relative"><job-hub-spinner diameter="20"></job-hub-spinner></span>
</p>
export class IdeaBoardComponent implements OnInit {
@Input() ideas: Idea[] = [];
@Input() gutter = 20;
@Input() col = 4;
@ViewChild(NgxMasonryComponent) masonry: NgxMasonryComponent;
loaded = 0;
cardWidth;
get hasPending(): boolean {
return this.ideas.length > 0 && Boolean(this.loaded < this.ideas.length);
}
constructor(
private sanitizer: DomSanitizer
) { }
ngOnInit(): void {
this.cardWidth = this.sanitizer.bypassSecurityTrustStyle(`calc((100% - ${(this.col - 1) * this.gutter}px) / ${this.col}`);
}
layoutCompleted(e) {
if (this.loaded > this.ideas.length) {
this.loaded = this.ideas.length;
return;
}
if (e && e.length === 1) {
this.loaded++;
}
}
reset() {
this.masonry.reloadItems();
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Strange behaviour when loading pages with masonry grid
Hi,. On the website of one of my clients we notice some strange behaviour with the layout of the 'portfolio' pages.
Read more >Vertical menu strange behaviour with Masonry - Stack Overflow
I am trying to use a masonry grid inside a semantic container which is in a column. I have created a simple fiddle...
Read more >masonry grid Bug · Issue #3751 · uikit/uikit - GitHub
The UIKIT 3 masonry grid have a big problem when calculating height / empty space ... In "uikit": "^3.7.3" I also see the...
Read more >Splitting content into another column when using Masonry ...
When using the Easy Post element in Oxygen and selecting the Masonry Preset, you may encounter strange layout behavior. Part of the description...
Read more >Masonry layout with CSS only! - YouTube
The first 1000 people to use the link will get a free trial of Skillshare Premium Membership: https://skl.sh/kevinpowell12201Masonry Layouts ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It works as charm!!! Legendary!
You can use the show/hide animation to set z-index to the items. When I work on the next release I’ll make it default as well.