dongshuql24533 2011-06-23 06:57
浏览 22
已采纳

自动调整缩略图在DIV中的位置(基于浏览器窗口宽度)?

I have a website that is displaying thumbnails that fits to the side. I have a bunch of thumbnails I want to fit. How it is now, there is a big gap when a picture goes to the next line.

Is there a way to have it automatically form fit so there will always be a image on the right and space out all the other thumbnails in between?

Here's my site: FlashPics Photostream

Sorry if it was confusing. You should see if you go to the link.

Thanks, Coulton

  • 写回答

2条回答 默认 最新

  • dsv768456 2011-06-23 09:00
    关注

    Sorry I could not find a CSS only solution. Here is a jQuery + CSS solution instead:

    jsFiddle Demo and code

    I've hooked a function inside the window.resize event that calculates the width required to show maximum number of images per row. The width is applied to the gallery wrapper so that it automatically center aligns itself within the window. The gaps between images plus the gap between left/right edge of the window remains consistent.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题