我有以下代码可以将更多内容附加到 Div 中,但不确定在哪里添加图像加载器,以便在添加新内容之前它显示在页面底部。
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$.getJSON("http://howtodeployit.com/?json=recentstories", function(data) {
newposts = data.posts.slice(currentPostcount, currentPostcount + desiredPosts);
$.each(newposts, function(key, val) {
//Append new contents
$("#postlist").listview().listview('refresh');
});
});
}});
我已经试过了,但它需要 AJAX:
beforeSend: function() { $('#loader').show(); },
complete: function() { $('#loader').hide(); },
最佳答案
试试这个。
$(window).scroll(function () {
if ($(window).scrollTop() == $(document).height() - $(window).height()) {
$('#loader').show();
$.getJSON("http://howtodeployit.com/?json=recentstories", function(data) {
$('#loader').hide();
$.each(data, function(key, val) {
//Append new contents
$("#postlist").listview().listview('refresh');
});
});
}
});
关于javascript - 滚动到页面末尾后添加 JQuery 微调器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19723708/