jQuery scroll事件
2014-04-03 18:24
357 查看
scroll事件适用于window对象,但也可滚动iframe框架与CSS overflow属性设置为scroll的元素。
注意:$(window).height()和$(document).height()的区别
补充一句$(window).scrollTop()和$(document).scrollTop()是没什么区别的,至少我在IE8中是一样的.
$(document).ready(function () { //本人习惯这样写了 $(window).scroll(function () { //$(window).scrollTop()这个方法是当前滚动条滚动的距离 //$(window).height()获取当前窗体的高度 //$(document).height()获取当前文档的高度 var bot = 50; //bot是底部距离的高度 if ((bot + $(window).scrollTop()) >= ($(document).height() - $(window).height())) { //当底部基本距离+滚动的高度〉=文档的高度-窗体的高度时; //我们需要去异步加载数据了 $.getJSON("url", { page: "2" }, function (str) { alert(str); }); } }); });
注意:$(window).height()和$(document).height()的区别
补充一句$(window).scrollTop()和$(document).scrollTop()是没什么区别的,至少我在IE8中是一样的.
相关文章推荐
- Jquerymobile 提交数据拿不到结果
- 简单jQplot创建引擎(支持线图/饼图/柱状图)
- [转]jquery.timer用法
- 10 个让人惊讶的 jQuery 插件
- jquery serialize介绍
- jquery offset() 与position()方法的区别
- 关于JQueryMobile 连接到自定义的外部html页面的Error Loading Page问题的解决
- jquery中使用offset()获得的div的left=0,top=0
- jquery ajax返回html乱码解决
- jQuery Mobile权威指南:添加按钮
- jquery toggle
- 判断本地是否存在Jquery文件,如果不存在则使用CDN加速的Jquery文件
- 精挑细选 8款HTML5/jQuery应用助网站走向高上大
- 关于jQuery trim 方法兼容性问题
- jQuery获取Select选择的Text和Value:
- JQuery初学_______(3)
- jQuery的$.proxy()应用示例介绍
- JQuery插件第三十八个:表单元素清空
- mini_magick+jquery.Jcrop+jquery.form.min
- JQuery OLAP Grid