谷歌图像异构拇指定位
Google 图片搜索返回不同尺寸的图片。甚至他们的拇指大小也不同。但它们的排列方式仍然保持干净的边缘。即使调整浏览器大小也能保持左右对齐正确。我注意到他们将图像页面分组到 ul 中,每个图像都在 li 中。并非所有行都包含相同数量的图像。但他们如何设法使不同尺寸的图像正确对齐呢?
编辑
虽然我已经接受了答案但它不完全匹配。这可能是一场势均力敌的比赛。但我仍然想知道他们正在做的具体程序是什么。我无法勾画出这个模式。 似乎他们将 page
包装在
但是当我调整大小时,图像会重新分配页面之间。但是
page
现在应该包含多少图像还有待决定。可以使用什么程序来实现这一点?我认为图像的大小也是根据
标准
高度来调整的。并且标准高度会在调整大小时发生变化。多少多少?这是怎么决定的?
中,并将图像放入
Google Image Search returns Images of different sizes. even their Thumbs are of different size. But still they are arranged in such a way that keeps a clean margin. even resizing the browser keeps the left and right alignment proper. What I've noticed is they group a Page of Image into an ul and each image is in an li. not all rows contain same amount of images. But still how they manage to keep images of different sizes properly aligned ?
EDIT
Though I've accepted an answer Its not exact match. It may be a near match. However I still want to know What is the exact procedure they are doing. I cannot chalk out the pattern.
It seems that they wrap a page
in a <ol>
and put images in <li>
But when I resize the images are redistributed among pages. But how many images the page <ol>
should contain now is to be decided. What procedure can be used to accomplish that ? and also images are resized based on a standard
height I think. and that standard height is changed on resize. How how much ? how that is decided ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这并不完全相同,但是通过查看 jQuery Masonry 插件。
It's not exactly the same thing, but you might get some useful ideas about how to optimize image "packing" by looking at the approach taken by the jQuery Masonry plug-in.
他们知道每个缩略图有多大,因为它存储在他们的图像数据库中。它们只是使每个
向左浮动,并根据该部分图像中最大的图像使它们具有固定大小。
They know how big each thumbnail is, since it's stored in their image database. They just make each
<li>
float left, and make them a fixed size based on whatever the largest image is within that section of images.我写了一个小插件就是为了做到这一点这里你可以观看实际操作:
要包含的库
I've written a little plugin just to do that HERE you can watch it in action:
libraries to include: