dimsemenov / Magnific-Popup

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

would like to find out how to locate the a link if its not directly a child of the parent div #1044

Closed giordifungula closed 6 years ago

giordifungula commented 6 years ago

My div is structured like this

my js file is structured like this var gallery = $('.gallery-item'); var category = '.item'; function filterIsotope( filter ) { 'use strict'; var filter = filter || '*'; gallery.isotope({ filter: filter, }); } var lightbox = $('.gallery-item'); function lightboxFilter( filter ) { 'use strict'; var filter = filter || '*'; lightbox.magnificPopup({ delegate: filter+'>a', type: 'image', gallery: { enabled: true, } }); } filterIsotope(); lightboxFilter(); gallery.imagesLoaded().progress(function() { 'use strict'; filterIsotope(); }); $('[data-filter]').on('click', function() { 'use strict'; var category = $(this).data('filter'); filterIsotope( category ); lightboxFilter( category ); });