Magnific-Popup icon indicating copy to clipboard operation
Magnific-Popup copied to clipboard

Open Popup Gallery from single button?

Open jezthomp opened this issue 9 years ago • 2 comments

I have a popup gallery working fine from a range of thumbnails, i just need a single button elsewhere on the page to open up the gallery on the first image?

Is this possible, my current method is not working..?

   var gallery_popup = function() {

                $('.popup_gallery').magnificPopup({
                  delegate: 'a',
                  type: 'image',
                  tLoading: 'Loading image #%curr%...',
                  mainClass: 'mfp-img-mobile',
                  gallery: {
                    enabled: true,
                    navigateByImgClick: true,
                    preload: [0,1] 
                  },
                  image: {
                    tError: '<a href="%url%">The image #%curr%</a> could not be loaded.',

                  }
                });

        };

        $('.gallery_link').click(function() {
         gallery_popup.magnificPopup('open');
        });

Am i missing something obvious?

jezthomp avatar Nov 24 '15 16:11 jezthomp

i tried the basic: $('.popup-with-zoom-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true,

    overflowY: 'auto',

    closeBtnInside: false,
    preloader: false,

    midClick: true,
    removalDelay: 300,
    mainClass: 'my-mfp-zoom-in'
});

and it works . i used this class .zoom-anim-dialog for an icon and it can popup.

without click function) show us your html5 code

maxmood avatar Dec 09 '15 06:12 maxmood

I'm also looking to open a gallery with a button, can't seem to figure it out

poonasor avatar Jun 24 '21 18:06 poonasor