滚动到页面末尾后添加 JQuery 微调器
Add JQuery spinner after scrolling to end of page
我有以下代码将更多内容附加到 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');
});
});
}
});
相关文章:
- JQuery添加元素需要在我的js之前再次添加JQuery脚本
- 通过jQuery添加ng样式属性,angular不更新
- 使用HTML5 localStorage和jQuery添加到收藏夹/书签
- jQuery添加的文本不显示
- 使用Jquery添加内容
- 如何使用jQuery添加另一个对象的高度作为边距
- JavaScript/jQuery-添加添加和删除类与下一个函数之间的延迟
- 对于每个json结果,使用类jquery添加css
- Jquery添加一个类之后,如何应用css
- 使用jQuery添加和删除属性
- Jquery添加输入字段和日期选择器
- jQuery - 添加删除类 - 设置输入值
- 为什么在这种情况下要向JQuery添加两个链接
- 为图像滑块jquery添加项目符号功能
- 使用jquery添加到表单内部表中的元素不会过帐
- 如何使用jquery添加元素
- 使用Jquery添加XML元素
- 当使用javascript/jquery添加值时,html文本输入表显示不正确
- 将jquery添加到firefox扩展中
- 运行 AJAX 需要什么 - 将 jQuery 添加到页面处理 AJAX 调用