jquery masonry ajax,jQuery Masonry and Ajax Append Items?

博客内容讲述了如何通过Ajax获取HTML片段,并将这些片段动态添加到页面的`divFeedList`元素中,同时利用jQuery的Masonry插件重新布局以保持网格效果。在Ajax成功回调中,使用`append`方法将响应内容添加到目标元素,并调用Masonry的`reloadItems`方法更新布局。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Following has worked for me. I have an ajax which returns set of html items (returns a partial view, from the ajax) when I click a load more button in my web page. Below is the partial view, which is dynamically generated.

foreach (var item in Model.SocialFeedList)

{

TitleOfTheLink

SomeDescription

Published: 2016/07/13

}

In the success callback ajax method, I have done the below,where "response" is the set of html items I get from the above html. Where "divFeedList" is the root element where I show the set of html elements.

jQuery("divFeedList").append(response).masonry('reloadItems', response, true).masonry();

Please let me know if the answer is unclear.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值