javascript jquery 同位素插件容器高度不会随着同位素项目而增长(与砖石相同)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12648376/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jquery isotope plugin container height will not grow with isotope-item (same with masonry)
提问by botbot
I have an isotope-item that will grow in height when somebody comments inside of it. When it grows, how do I tell the main isotope container to grow with it? Right now what is happening is, as the isotope-item grows, the isotope container maintains it's initial height that was set when calling $(".home_main").isotope(); So when I leave comments inside the isotope-item, the item grows, then is cut off by the main container. Thanks.
我有一个同位素项目,当有人在其中发表评论时,它的高度会增加。当它生长时,我如何告诉主要同位素容器与它一起生长?现在发生的事情是,随着同位素项目的增长,同位素容器保持其在调用 $(".home_main").isotope(); 时设置的初始高度;因此,当我在同位素项目内留下评论时,项目会增长,然后被主容器切断。谢谢。
I have seen that you can set resizesContainer: true
but this hasn't helped me. Thanks.
我已经看到您可以设置,resizesContainer: true
但这对我没有帮助。谢谢。
Not sure if it makes any difference but I have also tried this with the Masonry jquery plugin as well (seems pretty similar) and had the same problem.
不确定它是否有任何区别,但我也尝试过使用 Masonry jquery 插件(看起来非常相似)并且遇到了同样的问题。
回答by botbot
Found the answer here:
在这里找到答案:
https://github.com/desandro/isotope/issues/275
https://github.com/desandro/isotope/issues/275
You have to call relayout like this:
你必须像这样调用重新布局:
$("#your_container").isotope( 'reLayout' )
回答by Kumar
In Isotope V2 the syntax is
在 Isotope V2 中,语法是
$("#your_container").isotope('layout')
回答by Miguel Medeiros
In Isotope PACKAGED v2.2.2, you can also 're-arrange / re-layout' your container:
在 Isotope PACKAGED v2.2.2 中,您还可以“重新安排/重新布局”您的容器:
$(window).scroll(function(){
$container.isotope( 'layout' );
}
回答by Mohammad b
In Isotope V3
在同位素V3
$(window).on('load', function(){
var $container = $('#your_container');
$container.isotope({
itemSelector: '.item'
});
});
回答by racemic
If your using the latest isotope, (not specified version but you can see the date of this comment) read the first link and include the appropriate couple of lines and include the library from the second link.
如果您使用最新的同位素(未指定版本,但您可以看到此评论的日期)阅读第一个链接并包含适当的几行并包含来自第二个链接的库。
http://isotope.metafizzy.co/appendix.html
http://isotope.metafizzy.co/appendix.html