我正在尝试实施此响应式图片库http://creative-punch.net/2014/01/full-screen-image-gallery-using-css-masonry/
但是,该示例使用了整个视口,但我使用的是带有引导程序的HTML5样板,并且我的图片库仅显示了两行,但没有默认的5列显示,如演示在此处所示:http://demos.creative-punch .net / masonry-gallery /
这是我用1200+ px宽度的容器得到的
我已将整个画廊放置在一个容器类中。但是我不确定必须调整哪些CSS属性才能使图像填充整个div。
我怎样才能做到这一点 ?
我创建了一个jsfiddle,但是我似乎无法在不包括整个项目的情况下复制该问题,但希望有人能对此有所帮助并能够演示正在发生的事情。http://jsfiddle.net/CVU3r/
<div class="grid-sizer"></div>
<div class="item">
<img src="http://placekitten.com/650/450" class="image">
<a class="overlay" href="#">
<h3 class="title">Some title</h3>
<div class="description">
<p>
Lorem ipsum dolor sit amet, <br>
consectetur adipisicing elit.
</p>
</div>
</a>
</div>
$(window).load( function() {
$('#container').masonry({
"itemSelector": ".item",
"columnWidth": ".grid-sizer",
});
});
因此,小提琴并没有提供太多帮助,但感谢您发布了可以提供的代码...
您将要在所有图库周围添加包装器div
的HTML
<body>
<div class="galleryContainer">
//this is where all the code in the gallery goes including the container on the gallery because it is dynamically changed
</div>
</body>
的CSS
.galleryContainer{
width: 50%; //or whatever you would like
height: 600px; //or whatever you would like
margin: 0 auto; //center the gallery horizontally
overflow: auto; //allows you to scroll the gallery when some pictures cant be displayed
}
之前的代码还允许所有调整大小和移动兼容性正常工作。希望这对您有所帮助
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句