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

Cant open/trigger lightbox via click or function #25

Open
uchoasvinicius opened this issue Dec 2, 2019 · 2 comments
Open

Cant open/trigger lightbox via click or function #25

uchoasvinicius opened this issue Dec 2, 2019 · 2 comments

Comments

@uchoasvinicius
Copy link

I searched the documentation and implementation itself, but found nothing similar to opening a gallery via @click or via a function called outside the component itself.

@theprobugmaker
Copy link

I think that this component is kinda encapsulated in the way it's created, I don't think it has customization support.

@PizzaPete
Copy link

A bit dirty, but I'm doing this following way:

import PhotoSwipe from 'photoswipe/dist/photoswipe';
import * as DefaultPhotoSwipeUI from 'photoswipe/dist/photoswipe-ui-default';
methods: {
    openGallery() {
      const pswpElement = document.querySelectorAll('.pswp')[0];
      const gallery = new PhotoSwipe(pswpElement, DefaultPhotoSwipeUI,
        this.images,
        {
          captionEl: false,
          shareEl: false,
        });
      gallery.init();
    },
}

Where this.images is the array containing the images passed down to PhotoSwipe.

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

3 participants