Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bricks only after all images are loaded #35

Open
SystemDisc opened this issue Jan 26, 2017 · 3 comments
Open

Add bricks only after all images are loaded #35

SystemDisc opened this issue Jan 26, 2017 · 3 comments

Comments

@SystemDisc
Copy link

Is it possible to wait for all images to be loaded before adding bricks? Using imagesLoaded, each brick gets added after that brick's images are loaded. This results in the order of bricks when you initially load the page to be different from when images are cached and available immediately. I'd rather wait for all bricks' images are loaded before adding any bricks to ensure that the same bricks are in the same order every time.

@rtodea
Copy link

rtodea commented May 15, 2017

Hi @SystemDisc,

I solved the issue by calling the layout method each time an image was loaded.

E.g.

…
<img class="card-image" [src]="searchResult.imageLink" (load)="triggerMasonryLayout()">
…

In the component that has the HTML:

constructor(
  @Inject(forwardRef(() => AngularMasonry)) private masonryContainer: AngularMasonry
) {
}

…

triggerMasonryLayout() {
  this.masonryContainer.layout();
}

@SystemDisc
Copy link
Author

My request was to set up masonry after ALL images have finished loading, instead of after each.

@rtodea
Copy link

rtodea commented May 16, 2017

Ok, I understand.

This Angular port uses the masonry JS plugin which had recently added horizontal ordering.
Check out this blog post.

I am curios if this would solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants