在 Magnific 弹出窗口中打开所有图像,而不仅仅是发布图像

Have all images open in Magnific Popup, not just post images

本文关键字:图像 不仅仅是 布图像 Magnific 窗口      更新时间:2023-09-26

我想知道如何让Magnific Popup处理所有图像,而不仅仅是发布图像。我特别希望它也适用于侧边栏中的图像。

这是我在Blogger博客的页脚小部件中使用的代码:

<link type='text/css' rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/magnific-popup.min.css' />
<script src='https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.0.0/jquery.magnific-popup.min.js' type='text/javascript'></script>
<script>
//<![CDATA[
$('.post-entry').magnificPopup({
delegate:'a[imageanchor="1"]',
gallery: {
    enabled: true
},
  type: 'image'
});
//]]>
</script>

如果我将其直接插入博客的模板中,它会适用于所有图像吗?如果是,在哪里?

你可能已经注意到我在这方面并不厉害?我知道这可能是基本的东西,但它仍然超出了我的范围。我将不胜感激任何人能给我的任何帮助。

You can add all the images in one div and call that div class in your javascript function 
<div class="popup-gallery">
<a href="placeholder"><img src="" width="75" height="75"></a>
<a href="placeholder"><img src="" width="75" height="75"></a>
<a href="placeholder"><img src="" width="75" height="75"></a>
<a href="placeholder"><img src="" width="75" height="75"></a>
</div>
Web Reference: http://dimsemenov.com/plugins/magnific-popup/
Or you can use FancyBox which is open source and easy to use