How to bind a dynamic DIV to Jquery Masonry plugin?

后端 未结 3 1947
借酒劲吻你
借酒劲吻你 2021-01-20 16:25

I have some DIV\'s in my HTML that I load dynamically using AJAX.

$(\"#workPanel\").load(\"ex.html\");

I also have some static links that onclic

3条回答
  •  自闭症患者
    2021-01-20 17:02

    Here is an example of adding items dynamically to a masonry collection:

    http://masonry.desandro.com/demos/adding-items.html

    Basically, you need to call the "reload" masonry option.

    For example to insert the jQuery item "newElement" into the #holder div:

    jQuery("#holder").prepend(newElement).masonry('reload')
    

提交回复
热议问题