这是我喜欢做的一个例子。 http://www.davidmielcarek.com/
我希望这些行的长度是固定的,但我每行可能有 2 或 3 张图像。
我早些时候尝试过,但它并没有真正起作用。
这是伪代码
start loop
get image width
calculate rowWidth
if (rowWidth > maxRowWidth){
start nested loop
grab thumbnails for this row only
resize the thumbnails using the row's aspect ratio so each row is the same width
call the thumbnails
end nested loop
reset some variables for the next row
check if this is the last post
}
end loop
我没有看到问题,但是当我将它放入实际代码中时,我无法让它工作,也许其他人可以更好地编码或指出我的缺陷?