javascript - Show/Hide content with Jquery, MVC -
i'm using mvc show on page comments on given post. code:
@foreach (var comment in post.comments) { <div> <img src="@url.action("getimage", "post", new { userid = comment.userid })" height="50" width="50"/> @html.displayfor(c => comment.user.firstname) @html.displayfor(c => comment.user.lastname): @html.displayfor(c => comment.text) @html.displayfor(c => comment.datecomment) </div> <hr /> }
so gives comments given post. how can show latest 3 post, , rest can loaded "more" button using jquery?
order comments latest ones first, on each show more
// if have comments class on each comment div $('div.comments').not(':visible')[0].show(); $('div.comments').not(':visible')[1].show(); $('div.comments').not(':visible')[2].show();
Comments
Post a Comment