dimsemenov / Magnific-Popup

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

Multiple gallery on ajax content #1157

Open agussuroyo opened 3 years ago

agussuroyo commented 3 years ago

Hello

I've a content that loaded from AJAX request, and I want multiple gallery on it. How I can make it work? I know about delegate config, but I don't want all delegated selector become one stack on gallery, I want it splitted per gallery, and here the example markup

<div class="container not-ajax-element">

    // Gallery 1
    <div class="gallery-wrap is-ajax-content">
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
    </div>

    // Gallery 2
    <div class="gallery-wrap is-ajax-content">
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
    </div>

    // Gallery 3
    <div class="gallery-wrap is-ajax-content">
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
        <a href="http://example-image.jpg">Sample</>
    </div>

</div>

All .gallery-wrap is come from ajax, and .container is not from ajax, I want make this work only initialize at once, and not after ajax complete, also splitted into three gallery, not one gallery,

like the delegate config but work on multiple ajax element, any ideas?

Thanks