我想将元素附加到 jquery.shapeshift 创建的网格中。 documentation表示添加元素后触发重新排列。我尝试过,但一无所获。我究竟做错了什么?请参阅示例 http://jsfiddle.net/LNysC/1307/
$(".container").shapeshift({
minColumns: 3
});
$("a").click(function(){
$(".container").append("<div></div>");
$(".container").trigger("ss-event-arrange");
});
非常感谢
最佳答案
您以这种方式添加的 div 尚未被容器识别为子级,因此您应该告诉容器您添加的 div 是一个要像这样对待的子级。
我知道应该有另一种方法可以做到这一点,但请尝试再次调用 $(".container").shapeshift()
来 reshape 容器,例如:
$(".container").shapeshift({
minColumns: 3
});
$("a").click(function(){
$(".container").append("<div></div>");
$(".container").shapeshift();
});
这是一个例子: http://jsfiddle.net/LNysC/1501/
关于javascript - 如何将元素添加到 jquery.shapeshift 网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22898862/