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

Gallery with Gallerize and AutoPlay doesn't show images #260

Closed
hugoserrana opened this issue Jan 8, 2019 · 4 comments
Closed

Gallery with Gallerize and AutoPlay doesn't show images #260

hugoserrana opened this issue Jan 8, 2019 · 4 comments

Comments

@hugoserrana
Copy link

hugoserrana commented Jan 8, 2019

When use gallery with gallerize and set autoPlay to true, the lightbox doesn't show anything. The result is the same as the issue: #69

Without autoPlay, the component works as expected.

What are the steps to reproduce?

Example:
<gallery gallerize [items]="images" autoPlay="true">

Which versions are you using for the following packages?

Angular: 7.2.0
Angular CDK: 7.2.1
Angular CLI: 7.1.4
Typescript: 3.1.6
Gallery: 4.0.1

@MurhafSousli
Copy link
Owner

Can you please add a reproduction https://stackblitz.com/edit/ngx-gallery

@hugoserrana
Copy link
Author

Oh, this works on your code. I will find what I'm doing wrong and post here.

@hugoserrana
Copy link
Author

Your stackblitz works. Just add auto play to this example and then stop work.
This example is on Gallerize Examples Page

@hugoserrana
Copy link
Author

Sorry for the delay, but I found the difference and why it works in your example.
When set autoPlay:
<gallery gallerize [items]="items" autoPlay="true"></gallery>

and just set images like that:

items: GalleryItem[] = [
  {
    srcUrl: 'https://preview.ibb.co/jrsA6R/img12.jpg',
    previewUrl: 'https://preview.ibb.co/jrsA6R/img12.jpg'
  }
];

The lightbox does not work.
One workaround is to set the light box items by reference:

images: GalleryItem[];

    constructor(public gallery: Gallery, public lightbox: Lightbox) { }

    ngOnInit() {
      this.items = this.imageData.map(item => new ImageItem({ src: item.srcUrl, thumb: item.previewUrl 
    }));

    /** Lightbox Example */

    // Get a lightbox gallery ref
    const lightboxRef = this.gallery.ref('lightbox');

    // Add custom gallery config to the lightbox (optional)
    lightboxRef.setConfig({
      imageSize: ImageSize.Cover,
      thumbPosition: ThumbnailsPosition.Top
    });

    // Load items into the lightbox gallery ref
    lightboxRef.load(this.items);
  }

I do not know if this is the desired behavior, because in the documentation it shows as if it were automatic, without needing to reference the lightbox and set the items manually.

Anyway, wonderful work on the component.

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