Jquery判断滚动条是否到达窗口顶部和底部
<script type="text/javascript">$(document).ready(function(){ alert($(window).height()); //浏览器时下窗口可视区域高度 alert($(document).height()); //浏览器时下窗口文档的高度 alert($(document.body).height());//浏览器时下窗口文档body的高度 alert($(document.body).outerHeight(true));//浏览器时下窗口文档body的总高度 包括border padding margin alert($(window).width()); //浏览器时下窗口可视区域宽度 alert($(document).width());//浏览器时下窗口文档对于象宽度 alert($(document.body).width());//浏览器时下窗口文档body的高度 alert($(document.body).outerWidth(true));//浏览器时下窗口文档body的总宽度 包括border padding margin var win_height=$(window).height(); var doc_height=$(document).height(); var scroll_top=$(document).scrollTop(); /* doc_height是文档的高度,scroll_top是滚动条上部离文档顶部的高度,window_height表示窗口高度。 当scroll_top == 0 时,表示滚动条已经到达窗口顶部。 当scroll_top + window_height >= doc_height 时,表示滚动条已经到达窗口底部。 */ //判断滚动条是否到达窗口底部 $(window).bind('scroll', function(){ //绑定滚动事件 if($(document).scrollTop() + $(window).height() >= $(document).height()){ console.log(win_height); console.log($(document).scrollTop()); console.log(doc_height); //...... } }); });</script>Jquery判断滚动条是否到达窗口顶部和底部的更多相关文章
- jQuery判断滚动条是上滚还是下滚,且是否到达底部或顶部
jQuery判断滚动条是上滚还是下滚,且是否到达底部或顶部:http://www.haorooms.com/post/jquery_scroll_upanddown //滚动条滚动加载更多内容 //判 ...
- js判断滚动条是否已到页面最底部或顶部实例
原文 本文实例讲述了js判断滚动条是否已到页面最底部或顶部的方法.分享给大家供大家参考.具体分析如下: 我们经常会看到很多的网站一个返回顶部效果就是当我们滚动条到指定位置时返回顶部出来了,否则就自动隐 ...
- 不同浏览器对document.documentElement和document.body的scrollheight ,scrollTop,clientHeight以及判断滚动条是否滚动到页面最底部 【转载】
前段时间学习怎么写一个瀑布流的时候,就接触到document.documentElement和document.body的区别,然后今天查资料的时候看到这篇博客,遂转载记录在此. 两种特殊的文档属性可 ...
- Jquery 判断滚动条到达顶部或底部
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- jQuery——检测滚动条是否到达底部
一.jQuery检测浏览器window滚动条到达底部 jQuery获取位置和尺寸相关函数:$(document).height() 获取整个页面的高度:$(window).height() ...
- jquery判断滚动条是否到底部
clientHeight:这个元素的高度,占用整个空间的高度,所以,如果一个div有滚动条,那个这个高度则是不包括滚动条没显示出来的下面部分的内容.而只是单纯的DIV的高度. offsetHeight ...
- jQuery判断滚动条滚到页面底部脚本
原文地址 http://www.111cn.net/wy/jquery/61741.htm
- jquery判断滚动条到底
$(document).scroll(function(){ var dHeight = $(document).height(); var wHeight = $(window).height(); ...
- JQuery 判断滚动条是否到底部
BottomJumpPage: function () { var scrollTop = $(this).scrollTop(); var scrollHeight = $(document).he ...
随机推荐
- C#获取本机mac地址
添加System.Management的引用, using System.Management; string mac = ""; ManagementClass mc = new ...
- 在JavaScript 自定义对象来模拟Java中的Map
直接看代码: //模拟一个Map对象 function Map(){ //声明一个容器 var container={}; //定义一个put方法,向容器中存值 this.put=function(k ...
- Failed to instantiate the default view controller for UIMainStoryboardFile 'Main'
给UITableViewController 展示数据时候 删除系统自带viewController 然后拖过来一个UITableViewController 指定class后没有指定main入口 报 ...
- java udp网络编程
import java.net.*; /* 通过UDP传输发送文字数据 1.建立socket服务 2.提供数据,并封装到数据包中 3.通过sokect服务的发送功能,将数据包发送出去 4.关闭资源 * ...
- C++C++ 指针(二)--c++ 指针(二)--c++
一.内存管理:new和delete 1.new操作符:从操作系统获得内存块,并返回该内存块的首地址. delete操作符:将new申请的内存返还给操作系统. 开始一个简单的例子: #include & ...
- c#读取文本文档实践1-File.ReadAllLines()
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.I ...
- java,android获取系统当前时间
SimpleDateFormat formatter = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss ");Date curDate = ...
- python 绘图工具 matplotlib 入门
转自: http://www.cnblogs.com/kaituorensheng/p/3440273.html matplotlib 是python最著名的绘图库,它提供了一整套和matlab相似的 ...
- 程序中double类型的数输出为什么要用lf
在c89和c++中double的输入和输入输出都用%lf 在c99中,double的输出必须用%f,而输入要用%lf oIER一般使用c++,所以输出直接%lf即可.
- java generic type
java generic type: 类型安全.类型参数化.不需要强制转换