本文介绍了如何让JQuery Masonry识别添加的项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是与此问题相同的问题,但我在此处上对该问题有一个保留.所以我以为我会转贴.

This is the same question as this one, but I have a repro of the issue on JSFiddle up here. So I thought I'd repost.

JQuery Masonry似乎只在第一次运行时评估其容器的子级一次.之后,就不可能再次查看DOM来重新评估其子级.

JQuery Masonry seems to only assess the children of its container once, on first run. After that, it's impossible to get it to look at the DOM again to get it to reassess its children.

推荐答案

您必须将新内容传递给Masonry的已添加方法:

You have to pass the new content to Masonry's appended method:

$("#container").append(content).masonry("appended", content);

我在此处更新了小提琴.

这篇关于如何让JQuery Masonry识别添加的项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 21:39