lightbox ajax 순차정렬
10 (id = 0)
9 (id = 1)
8 (id = 2)
7 (id = 3)
//
... offset =>3 (last)... 기호는 > 이상
다음보여줄것은
6 (id = 4)
5 (id = 5)
4 (id = 6)
3 (id = 7)
desc.가맞고
last > desc
function lightbox(post_id,page){
if (!post_id || !page) { return false; }
$("#modal-progress").removeClass('hidden');
$.get((xhr_url() + 'posts/lightbox'), {post_id:post_id,page:page},function(data) {
if (data.status == 200) {
$(".lightbox__container").html(data.html);
}
else{
$(".lightbox__container").empty();
}
$("#modal-progress").addClass('hidden');
},dataType= 'json');
window.history.pushState({state:'new'},'', site_url( 'post/'+post_id ));
}
function load_tlp_comments(post_id,zis) {
if (post_id && $.isNumeric(post_id) && zis) {
var post = $('.timeline-posts[data-post-id="'+post_id+'"]');
var first = post.find('.post-comments-list').find('[data-post-comment]').first();
var last = post.find('.post-comments-list').find('[data-post-comment]').last();
var cmid = last.data('post-comment');
var zis = $(zis);
if ($.isNumeric(cmid)) {
zis.attr('disabled', 'true');
$.ajax({
url: link('posts/load-tlp-comments'),
type: 'POST',
dataType: 'json',
data: {post_id: post_id,offset:cmid},
})
.done(function(data) {
if (data.status == 200) {
$(data.html).insertAfter(last);
$(data.html).insertAfter(first);
}
else{
zis.text(data.message);
delay(function(){
zis.fadeOut(300, function() {
$(this).parent('li').remove();
});
},3000);
}
zis.removeAttr('disabled');
});
}
}
}