Skip to content

Commit a2441c0

Browse files
authored
修复第二次翻页错误
1 parent 958fe3a commit a2441c0

File tree

1 file changed

+28
-21
lines changed

1 file changed

+28
-21
lines changed

Akina/js/global.js

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -202,28 +202,35 @@ var loadSingle = function(){
202202

203203
// 评论分页
204204
$body=(window.opera)?(document.compatMode=="CSS1Compat"?$('html'):$('body')):$('html,body');
205-
// 点击分页导航链接时触发分页
206-
$('#comments-navi a').on('click', function(e){
207-
e.preventDefault();
208-
$.ajax({
209-
type: "POST",
210-
url: $(this).attr('href'),
211-
beforeSend: function(){
212-
$('#comments-navi').remove();
213-
$('#comments-ajax').remove();
214-
$('#loading-comments').slideDown();
215-
$body.animate({scrollTop: $('#comments-list-title').offset().top - 65}, 800 );
216-
},
217-
dataType: "html",
218-
success: function(out){
219-
result = $(out).find('#comments-ajax');
220-
nextlink = $(out).find('#comments-navi');
221-
$('#loading-comments').slideUp('fast');
222-
$('#loading-comments').after(result.fadeIn(500));
223-
$('#comments-ajax').after(nextlink);
224-
}
205+
// ajax 翻页执行函数
206+
ajaxNav()
207+
// ajax 翻页函数
208+
function ajaxNav() {
209+
$('#comments-navi a').on('click', function(e){
210+
e.preventDefault();
211+
$.ajax({
212+
type: "POST",
213+
url: $(this).attr('href'),
214+
beforeSend: function(){
215+
$('#comments-navi').remove();
216+
$('#comments-ajax').remove();
217+
$('#loading-comments').slideDown();
218+
$body.animate({scrollTop: $('#comments-list-title').offset().top - 65}, 800 );
219+
},
220+
dataType: "html",
221+
success: function(out){
222+
result = $(out).find('#comments-ajax');
223+
nextlink = $(out).find('#comments-navi');
224+
$('#loading-comments').slideUp('fast');
225+
$('#loading-comments').after(result.fadeIn(500));
226+
$('#comments-ajax').after(nextlink);
227+
// 再次执行 绑定一下事件
228+
ajaxNav()
229+
}
230+
});
225231
});
226-
});
232+
}
233+
227234

228235
// 顶部加载条
229236
var loading = function(){

0 commit comments

Comments
 (0)