admin管理员组文章数量:1321608
I am using jQuery Masonry to display a grid of boxes (all the same size).
Here is my testing site.
Works great when the browser width is 1100px or below.
When viewing it at 1270px and above, Masonry keeps adding columns on the right hand side.
I have a max-width set on the outer container, but Masonry doesn't seem to acknowledge it and just keeps expanding the width of the Masonry container.
On the Masonry Centered page, you can see that it is centered, but there is no constraining width. As you increase the browser width, it just keeps expanding and adding more columns.
How can I add a hard rule to say, "This is the maximum width. Stop trying to add more columns."
Thanks
UPDATE Here is a jsfiddle, although I"m not sure if it's even set up correctly. It's best just to go to my testing site to see the problem.
I am using jQuery Masonry to display a grid of boxes (all the same size).
Here is my testing site.
Works great when the browser width is 1100px or below.
When viewing it at 1270px and above, Masonry keeps adding columns on the right hand side.
I have a max-width set on the outer container, but Masonry doesn't seem to acknowledge it and just keeps expanding the width of the Masonry container.
On the Masonry Centered page, you can see that it is centered, but there is no constraining width. As you increase the browser width, it just keeps expanding and adding more columns.
How can I add a hard rule to say, "This is the maximum width. Stop trying to add more columns."
Thanks
UPDATE Here is a jsfiddle, although I"m not sure if it's even set up correctly. It's best just to go to my testing site to see the problem.
Share Improve this question edited May 13, 2012 at 19:30 davecave asked May 11, 2012 at 3:49 davecavedavecave 4,8186 gold badges29 silver badges34 bronze badges 6-
1
have you tried using the
containerStyle
option to masonry? – x1a4 Commented May 12, 2012 at 4:32 -
I included the
containerStyle
option, but it doesn't seem to read it for some reason. Right now that should putposition: absolute
on the project wrapper, but it's not. – davecave Commented May 12, 2012 at 5:54 - Here is the fiddle. Not the best fiddle ever, but it works. If you can get it to not expand beyond 3 columns, you get a cookie. Don't worry about the weird hover states. jsfiddle/26dsg/4/embedded/result – davecave Commented May 12, 2012 at 6:11
- that !important seems to break your layout. Try without it. – user201788 Commented May 17, 2012 at 4:40
-
It seems the resize issue it still happening after deleting
!important
– davecave Commented May 17, 2012 at 20:13
1 Answer
Reset to default 7Setting a max-width
on the parent element of the masonry'ed container works for me. Is this not the result you're looking for?
#wrapper { max-width: 990px; }
本文标签: javascriptjQuery MasonryConstrain to a Maximum Width on Window Resize EventStack Overflow
版权声明:本文标题:javascript - jQuery Masonry—Constrain to a Maximum Width on Window Resize Event? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742101711a2420831.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论