瀑布流翻页 锁的实现
来源:互联网 发布:windows 10 安装office 编辑:程序博客网 时间:2024/05/17 06:06
在用到瀑布流下拉翻页时,js的响应事件:
$(window).scroll(function() {if ($(document).scrollTop() >= $(document).height() - $(window).height()) {//滚动到底部 ajax_get();}});代表当滑动条滑动到底部时的响应事件
但这样会有一个问题,就是有时候可能会触发2次或多次,特别是在网络比较差的时候,会发送多个相同的请求,导致刷出多个相同的数据页面
这里加上一个锁
在js的最前面初始化一个全局变量suo=1
然后在ajax_get();这个方法中
function ajax_get(){if (suo == -1) {return;} suo = -1; $.ajax(){url: "/index.php?m=Home&c=Group&a=group_Topic_GetPageList",async: true,data: {page: page,},dataType: 'json',success:function(data){suo = 1;} }}
0 0
- 瀑布流翻页 锁的实现
- Ajax +Jq+php实现的瀑布流翻页,加载中动画
- 瀑布流的实现
- 瀑布流的实现
- 瀑布流的实现
- iOS瀑布流的实现
- android 瀑布流 的实现
- 图片瀑布流的实现
- 瀑布流的实现原理
- Android瀑布流的实现
- UICollectionView的瀑布流实现
- 简单瀑布流的实现
- JS实现的瀑布流
- 简单的瀑布流的实现
- 翻页功能的实现
- 翻页功能的实现
- 翻页功能的实现
- 特别简单的android瀑布流实现
- 为Eclipse构建Maven项目
- 九度OJ 1190:大整数排序 (大数运算、排序)
- 相变冷却系统应注意的一些问题
- textView键盘自动弹出
- Xcode 7 支持http请求info.plist设置
- 瀑布流翻页 锁的实现
- glog
- log4j常用配置信息
- Intellij IDEA无法启动:Failed to create JVM:error code -4
- 【Android】Android中使用JNI调用底层C++代码
- 了解echo命令语法及应用
- Android自定义EditText实现手机号码和银行卡号自动分隔
- android.app.ActionBar $LayoutParams cannot be cast to android.widget.FrameLayout$LayoutParams
- 0002 C++字符串的详解