(document).height()、$(document).scrollTop(),有需要的朋友可以参考下。

jQuery(window).height()代表了当前可见区域的大小,而jQuery(document).height()则代表了整个文档的高度,可视具体情况使用.

注意当浏览器窗口大小改变时(如最大化或拉大窗口后) jQuery(window).height() 随之改变jQuery(document).height()是不变的。

$(document).scrollTop() 获取垂直滚动的距离 即当前滚动的地方的窗口顶端到整个页面顶端的距离

$(document).scrollLeft() 这是获取水平滚动条的距离

要获取顶端 只需要获取到scrollTop()==0的时候 就是顶端了

要获取底端 只要获取scrollTop()>=(document).height()−(window).height() 就可以知道已经滚动到底端了

height:指元素内容的高度 ,jQuery中的height()方法返回的就是这个高度。 
clientHeight:内容高度+padding高度 ,jQuery中的innerHeight()方法返回的就是这个高度。 
offsetHeight:内容高度+padding高度+边框宽度 ,jQuery中的outerHeight()方法返回的就是这个高度。

(document).height()、$(document).scrollTop()的更多相关文章

  1. 拉动滚动条追加内容,无限延伸document高度 $(window).scroll(function(){if($(window).scrollTop() + $(window).height() == $(document).height()) { $("body").append(html) } })

    $(document).ready(function() { // endless scrolling $(window).scroll(function() { if($(window).scrol ...

  2. $(window).scrollTop() == $(document).height() - $(window).height()(底端)

    jQuery(window).height()代表了当前可见区域的大小,而jQuery(document).height()则代表了整个文档的高度,可视具体情况使用. 注意当浏览器窗口大小改变时(如最 ...

  3. (document).height()与$(window).height()

    jQuery(window).height()代表了当前可见区域的大小,而jQuery(document).height()则代表了整个文档的高度,可视具体情况使用. 注意当浏览器窗口大小改变时(如最 ...

  4. (document).height()与$(window).height()区别

    jQuery(window).height()代表了当前可见区域的大小,而jQuery(document).height()则代表了整个文档的高度,可视具体情况使用. 注意当浏览器窗口大小改变时(如最 ...

  5. 网页上弹出pop窗口实例,(document).height()与$(window).height()的区别

    #dvbg{background-color:#666666; position:absolute; z-index:99; left:0; top:0; display:none; width:10 ...

  6. js 浏览器窗口大小改变 高度 宽度获取 window/document.height()区别

    <script> //当浏览器的窗口大小被改变时触发的事件window.onresize window.onresize = function(){ console.log($(windo ...

  7. $(window).height() 和 $(document).height()的区别

    $(window).height() 和 $(document).height()的区别 $(window).height()代表了当前可见区域的大小,$(document).height()则代表了 ...

  8. window + document + height

    jQuery(window).height()代表了当前可见区域的大小,而jQuery(document).height()则代表了整个文档的高度,可视具体情况使用.     注意当浏览器窗口大小改变 ...

  9. $(document).height 与$(window).height的区别

    $(document).scrollTop() 获取垂直滚动的距离 (即当前滚动的地方的窗口顶端到整个页面顶端的距离)$(document).scrollLeft() 这是获取水平滚动条的距离 要获取 ...

随机推荐

  1. input标签name与value区别

    id是唯一标识符,不允许有重复值(类似数据表的主键)可以通过它的值来获得对应的html标签对象.(如果在同一页面代码中,出现重复的id,会导致不可预料的错误) name:单独地在一个网页里面,一个控件 ...

  2. 了解JavaWeb,一篇就够

    把HTML.CSS.JSP.JS.JavaScript,JQuery,STRUTS,String,MVC,DOM 柔和起来,贯穿成一篇完整的内容,让读者明白JavaWeb的前前后后. 从Servlet ...

  3. 估计PI——OpenCV&Cpp

    来源:<Learning Image Processing With OpenCV> 算法原理:蒙特卡洛 PI的计算公式: Cpp代码: #include <opencv2/open ...

  4. PSP(16/03/14-16/03/15)

    //整理了自己过去的时间记录文件,最早用电子版记录是15/04/21,依旧断断续续记录到15/11/21,每月至少三次记录,然而自己并没有对数据进行整理,只是纯粹记录,真是浪费了花在上面的时间.期间八 ...

  5. 使用Navicat修改SQLite数据库提示:no such collation sequence: LOCALIZED

    今天在修改Android应用里用到的一个SQLite数据库文件,使用Navicat修改SQLite数据库提示:“no such collation sequence: LOCALIZED”错误,折腾了 ...

  6. sqlite实现oracle的rownum功能

    SELECT (SELECT COUNT(*) FROM [table] AS t2 WHERE t2.name <= t1.name) AS rowNum, id, name FROM [ta ...

  7. Objective C运行时(runtime)

    #import <objc/runtime.h> void setBeingRemoved(id __self, SEL _cmd) { NSLog(@"------------ ...

  8. stray'\241'in program

    stray '\241' in program : 该错误是指源程序中有非法字符,需要去掉非法字符.一般说来,如果你从其他地方复制代码过来,可能会出现这个问题.中文空格中文引号中文各种标点符号都会引起 ...

  9. Oracle优化总结

    本文主要从大型数据库ORACLE环境四个不同级别的调整分析入手,分析ORACLE的系统结构和工作机理,从九个不同方面较全面地总结了ORACLE数据库的优化调整方案.关键词 ORACLE数据库 环境调整 ...

  10. PAT (Advanced Level) Practise:1001. A+B Format

    [题目链接] Calculate a + b and output the sum in standard format -- that is, the digits must be separate ...