我以Yii 1.x widget的形式使用Colorbox。一切都很好,除了Colorbox不对我的图像进行分组,也不显示<-- / -->按钮。
这是我的页面生成的代码的一部分:
<div class="media-gallery-wrapper">
<div class="media-gallery-item">
<a href="http://127.0.0.1/usrector/htdocs/uploads/galleries/15.jpg" class="colorbox cboxElement" title="">
<img src="http://127.0.0.1/usrector/htdocs/uploads/galleries/15small.jpg" alt="" width="450" height="450">
</a>
</div>
</div>每三个这样的块后面紧跟着:
<div class="media-gallery-separator"></div>仅此而已。尽管我一直在尝试修改我的代码并浏览Colorbox示例,但我看不出我的代码与examples上的代码有任何显著的区别。因此,我不知道,是什么让我的Colorbox不对图像进行分组?
发布于 2015-03-19 21:43:29
在Colorbox中分组仅适用于,如果您将其基于rel属性。你不能使用类。
所以,这是:
<a href="<?php echo $filename; ?>" class="colorbox" title="<?php echo $title; ?>">
<script type="text/javascript">
jQuery('.colorbox').colorbox({'maxHeight':'80%','maxWidth':'90%'});
</script>将不起作用(没有图像分组,没有<- / ->按钮),而这是:
<a href="<?php echo $filename; ?>" rel="colorbox" title="<?php echo $title; ?>">
<script type="text/javascript">
jQuery('a[rel="colorbox"]').colorbox({'maxHeight':'80%','maxWidth':'90%'});
</script>将会像护身符一样起作用。
https://stackoverflow.com/questions/29124081
复制相似问题