I've been looking for a responsive lightbox that will autoplay a gallery starting at a specified point in the gallery. Magnific Popup looks pretty solid. Anyone have a way for it to act as a lightbox slideshow - that is, have the gallery autoadvance?
Looks from the Magnific documentation like there should be a way that makes use of magnificPopup.next();
, magnificPopup.updateItemHTML();
and/or callback events, but that's beyond my javascripting
thanks!
edit: if you're thinking "umm fancybox's autoPlay?," sure, that would work also. I'd still like to try out Magnific
I figured it out after a bit of tinkering though there is a quirk. I have two instances of magnificPopup on the page. One called only on elements and not in gallery mode and one with all items in an array and gallery enabled. This code is in the later of the two. It, however, effects BOTH instances and my 'non' gallery refreshes every 5 seconds! Regardless, the below code is what you're looking for:
My Magnific Popup slide show uses a small form with a "Start Slide Show" button and an input for the desired interval. The slide show object has basically the following code:
The slide show property currImgNo is used to enter the slide show with the last popuped image and to prevent looping.
Magnific Popup got extra lines in the open and close event handlers:
This works fine, at least for some of WebKit and Gecko browsers that I tested.
My version additionally launches full screen mode, but that requires some more code to work across browsers.
Simply put interval in
open
callback.Of course it's very basic implementation, but you may go as far as you need.