dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.38k stars 3.49k forks source link

Lacking Clarity on Working With Dynamic Gallery #1116

Closed harrisonfm closed 5 years ago

harrisonfm commented 5 years ago

I'm using Magnific 1.1, and creating a gallery of inline items. That's been fine. I'm next trying to add content dynamically to the gallery (infinite scroll) and keep Magnific working, but I am struggling to get it across the finish line.

Other libraries often will just let you reinstantiate, I don't see that as an option here. Trying to do that in my AJAX success gives various errors depending on whether I try pushing new content to instance.items w/ push & updateItemHTML() or if I try to call MagnificPopup() again.

Is there a clear way to do this?

harrisonfm commented 5 years ago

Okay, I resolved this.

I simply needed to re-instantiate on each append with all my options.

Also, instructions from the author on StackOverflow instructing to use updateItemHTML() were a red herring for me. I'm not using that function at all, nor am I adding items manually.