Grid generation amp; division with css/js/php(网格生成与用 css/js/php 划分)
问题描述
我正在做一个网络项目,我正在考虑如何最好地处理以下场景:
I am working on a web project, and I am thinking on how to best approach the following scenario:
我在数据库中有一堆图像,我想将其加载到网格中.排名靠前的图片需要更大的画布,而排名较低/未排名的则不需要.图像的尺寸不是标准的,因此它可以是具有不同尺寸的纵向或横向图片.纵横比需要保持不变,并且窗口需要完全水平填充(宽度为 100%).用户可以垂直滚动.
I have a bunch of images in a database and I want to load this in a grid. High ranked images need to have a bigger canvas, while lower/not ranked ones don't. The size of the images are not standard so it could be either a portrait or a landscape picture with each different sizes. The aspect ratio needs to remain intact, and the window needs to be totally filled horizontally (with a width of 100%). Users can scroll vertically.
为了让您了解网格中字段的划分,我附上了一个快速线框.
To give you an idea of the division of the fields in the grid, I have attached a quick wireframe.
你们知道如何最好地解决这个问题吗?我在想也许我应该标准化"几行.并随机放置行,使其看起来不像预设.但这显然不是真正计算出来的.任何想法表示赞赏!
Do you guys have an idea on how to approach this best? I was thinking maybe I should "standardize" a few rows. And place the rows randomly so that it does not look pre-set. But this is obviously not really calculated. Any thoughts are appreciated!
推荐答案
最终使用 Masonryhttp://masonry.desandro.com/
Ended up using Masonry http://masonry.desandro.com/
我通过将 window.width 除以 5 来设置每一列的宽度.
I set the width of each individual column, by dividing the window.width by 5.
这篇关于网格生成与用 css/js/php 划分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:网格生成与用 css/js/php 划分
基础教程推荐
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 在多维数组中查找最大值 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01