How do I define a gallery of inline content in HTML for use with Magnific-Popup ?

一个人想着一个人 提交于 2019-12-01 18:54:44

It doesn't work this way, delegate is always looking for children of target DOM element (in your case children of element .open-gallery-link).

You may just parse everything via jQuery and open gallery via API:

$('.open-gallery-link').click(function() {

  var items = [];
  $( $(this).attr('href') ).find('.slide').each(function() {
    items.push( {
      src: $(this) 
    } );
  });

  $.magnificPopup.open({
    items:items,
    gallery: {
      enabled: true 
    }
  });
});

http://codepen.io/dimsemenov/pen/zvLny

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!