Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在考虑在我的一个项目中使用Masonry 插件。我想知道是否有可能以某种方式检测在放置 div 时有时会出现在布局中的空白空间。如果我有办法检查这些空白,我可以用一些生成的 div 填充它们,其中包含一些数据。
我会玩 offset().left。例如:
这将检查我们的起始项目旁边的项目是否确实存在。请注意,outerWidth(true) 确保项目之间的边距也被计算在内。
希望我的理论对你有意义, 祝你好运。