'; html += '
'; html += $("#commentArea").find('textarea').val(); html += ''; $("#commentArea input[name='at_id']").val(''); $("#commentArea input[name='at_uid']").val(''); $("#commentArea textarea[name='content']").val(''); if (result.at_id && $('#comment_' + result.at_id).length > 0) { if ($('#comment_' + result.at_id + ' .media-body .media-list').length == 0) $('#comment_' + result.at_id + ' .media-body').append(''); else $('#comment_' + result.at_id + ' .media-body .media-list').append(html); } else { if ($("#allComments>ul>li").length > 0) $("#allComments>ul>li:first").before(html); else $("#allComments>ul").html(html); } } else { $.dialog({content: result.msg, title: 'alert',time: 1000}); } }, "json"); }); var loading = $("#loading").data("on", false); $('.news-container #targetid').change(function () { pageIndex = 1; targetid = $('.news-container #targetid').val(); $('#allComments .media-list').html(''); loading.data("on", false).fadeOut(); $(window).scroll(); }); $('.wrapper').on('scroll', function () { console.log('ok'); if (loading.data("on") || loading.data("on") == "over") { return; } var height1 = this.scrollTop; var height2 = this.scrollHeight - $(window).height() - ($(document).height() - $('#_mod_comments').offset().top - $('#_mod_comments').height()); if (height1 > height2) { loading.data("on", true).fadeIn(); var url = '/index.php?route=article/comment/loadcomment&id=365092&page=' + pageIndex; $.get(url, function (dataJson) { if (dataJson.errCode == "1") { loading.data("on", "over").fadeOut(); return; } if ($('#top_reply .page-header h4 span em').text() == '0') $('#top_reply .page-header h4 span em').text(dataJson.total); $.each(dataJson.data, function (j, result) { var html = ''; $("#allComments>ul").append(html); }); pageIndex += 1; loading.data("on", false).fadeOut(); }, 'json'); } }); });