作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想知道如何让 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
关于javascript - 在 Magnific Popup 中打开所有图片,而不仅仅是发布图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36138378/
我是一名优秀的程序员,十分优秀!