如何使用固定宽度的同位素或砌体?
我一直无法找到一种方法来使用同位素(或砌体)与固定宽度的外部容器。
它总是坚持重新调整大小。我浏览了选项、代码、谷歌和这里,但没有找到答案。
有可能吗?
I have not been able to find a way to use Isotope (or Masonry) with a fixed width outer container.
It always insists on re-sizing. I've looked through the options, code, google and here and haven't found the answer.
Is it even possible?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你的问题似乎倒退了问题
我正在经历。砌体最适合流体容器,但我想要中心的固定宽度为 980px(主类即:边距:0 auto;宽度 980px;)
然后砌体不起作用
Your question seems backwards to the problem
I was having. Masonry works best with fluid containers but I wanted a fixed width of 980px on my center (main class ie: margin:0 auto; width 980px; )
Then masonry doesn't work????... The fix is to find the center or whatever class u use to contain all content to a set width and change it from width to max-width:980px. This means ur still on fixed width centered container but masonry items will readjust / relayout upon resizing the browser.
I have a module I'm working on at www.digi2020.com - choose menu -> portfolio and u will see that does just this. I've added a lot of bells and whistles but a simple call to masonry will achieve same effect.
Inspect and Check out the .main class and the JavaScript on that page.
Another example using isotope on a fixed width that does not allow items to relayout on resize but still provides filtering can be found on pressedweb.com/portfolio
通常,当您将外部容器设置为
max-width
时,就会发生这种情况。我使用了width:960px
并且在调整浏览器窗口大小后它不会干扰砖石网格。也许检查所有您的外容器?Usually this happens when you set the outer container to
max-width
. I have usedwidth:960px
and it does not interfere with the masonry grid after resizing the browser window. Maybe check all of your outer containers?