jQuery Masonry and Ajax Append Items?

前端 未结 13 1396
借酒劲吻你
借酒劲吻你 2020-12-08 07:19

I am trying to use some ajax and the jQuery Masonry plugin to add some items - but for some reason the new items aren\'t getting the masonry applied ?

I\'m using

13条回答
  •  萌比男神i
    2020-12-08 07:55

    success: function (response) {
      if(response.length > 0) {
         var el = js(response); 
         setTimeout(function () {
           js("#masonry").append(el).masonry( 'appended', el).masonry('layout');
         }, 500);
      }
    }   
    

    works fine for me.

提交回复
热议问题