在PrettyPhoto中显示多个图像
Displaying multiple images in PrettyPhoto
我正在建一个网站,其中一个页面上有一个展示一些图片的部分。我觉得prettyPhoto看起来不错,于是决定使用它。
现在,我在引导程序中有一个正方形的"盒子",有2个col-md-4行(总共6行)。每个图像都有一个悬停状态,悬停时会发生变化,显示一个可单击的图标,然后打开prettyPhoto。
考虑到文档,我不知道如何将多个图像添加到prettyPhoto中,但他们的文档中有一些例子,我只是没有运气实现它们。
这是我的代码
html
<div class="row centered">
<div class="col-md-4 portfolio-item web-design">
<div class="he-wrap tpl6">
<img src="images/portfolio-2/crate-of-california.jpg" height="450px" width="600px" class="img-responsive" alt="">
<div class="he-view">
<div class="bg a0" data-animate="fadeIn">
<h3 class="a1" data-animate="fadeInDown">Crate of California</h3>
<a data-rel="prettyPhoto[gallery1]" href="images/portfolio-2/crate-of-california.jpg" width="600" height="486" class="dmbutton a2" data-animate="fadeInUp"><i class="fa fa-search"></i></a>
</div><!-- he bg -->
</div><!-- he view -->
</div><!-- he wrap -->
</div>
js
(function($) {
// prettyPhoto
jQuery(document).ready(function(){
jQuery('a[data-gal]').each(function() {
jQuery(this).attr('rel', jQuery(this).data('gal'));
});
jQuery("a[data-rel^='prettyPhoto']").prettyPhoto({animationSpeed:'slow',theme:'light_square',slideshow:false,overlay_gallery: false,social_tools:false,deeplinking:false,allow_resize:true});
});
})(jQuery);
如果需要的话,我可以发布css,但大部分都与问题无关。
有人知道我如何用prettyPhoto在每张图片上显示多个图片(画廊)吗?如有任何帮助,我们将不胜感激。
所以我能够弄清楚这一点,网站上的文档一点都不好,我花了几个小时才弄清楚,所以希望有人能利用它。
基本上,我试图为我的2x3行中的6个图像中的每一个显示一个图像库。代码最终为;
html
<div class="col-md-4 portfolio-item web-design">
<div class="he-wrap tpl6">
<img src="images/portfolio-2/kenneth-cole.jpg" height="450px" width="600px" class="img-responsive" alt="">
<div class="he-view">
<div class="bg a0" data-animate="fadeIn">
<h3 class="a1" data-animate="fadeInDown">Kenneth Cole</h3>
<a rel="prettyPhoto[gallery2]" href="images/portfolio-2/kenneth-cole.jpg" class="dmbutton a2" data-animate="fadeInUp"><i class="fa fa-search"></i></a>
<a href="images/portfolio-images/kennethcole2.png" class="lightbox-image lightbox-hide" rel="prettyPhoto[gallery2]" title="Another Title 2"></a>
<a href="images/portfolio-images/kennethcole3.png" class="lightbox-image lightbox-hide" rel="prettyPhoto[gallery2]" title="Another Title 2"></a>
<a href="images/portfolio-images/kennethcole4.png" class="lightbox-image lightbox-hide" rel="prettyPhoto[gallery2]" title="Another Title 2"></a>
</div><!-- he bg -->
</div><!-- he view -->
</div><!-- he wrap -->
</div>
.....
<!-- beneath your main content, before your closing body tag
the social tools (twitter and facebook sharing) are in there by default, so this takes it off -->
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:''});
});
</script>
</body>
基本上,你只需要确保你的"触发器"是rel=prettyPhoto
,并且你可以在每个分区中有多个。一旦你看到多个图像,prettyPhoto就会有助手和按钮。
相关文章:
- 非常大的图像显示渐进
- CSS Html使图像显示在单选按钮的选项上(单选按钮被CSS隐藏)
- JS照片库.使大图像显示和缩略图可单击
- 多个图像显示带有动态创建的画布的最后一个图像并分配给图像
- 当我在jquery/javascript中单击按钮时加载图像显示
- React图像显示
- 随机图像显示,无重复,使用Javascript
- 将跨度内容(图像url)转换为图像(显示)
- 随机图像显示不止一次
- 节点.js 使用 Multer 上传图像显示未定义
- 范围滑块,用于更改轨道上方对齐圆的直径并使对齐的图像显示在下方
- 使用图像显示和隐藏
- 使用 JavaScript 将文件夹中的图库图像显示到网页中
- 画布到图像显示为无图像(空白)
- 传单不会将本地图像显示为叠加
- 切换此元素时,如何使不同的图像显示,而不是文本
- 在页面加载时将图像显示为弹出窗口
- 如何在模糊浏览器主窗口时将图像显示为叠加层
- iOS在画布上绘制图像显示:无会导致内存泄漏
- JavaScript 图像显示不起作用