/*滚动条在Y轴上的滚动距离*/
function ScrollTop()
{
var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
if (document.body)
{
bodyScrollTop = document.body.scrollTop;
}
if (document.documentElement)
{
documentScrollTop = document.documentElement.scrollTop;
}
scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
return scrollTop;
}
/*文档的总高度*/
function ScrollHeight()
{
var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
if (document.body)
{
bodyScrollHeight = document.body.scrollHeight;
}
if (document.documentElement)
{
documentScrollHeight = document.documentElement.scrollHeight;
}
scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
return scrollHeight;
}
/*浏览器视口的高度*/
function WindowHeight()
{
var windowHeight = 0;
if (document.compatMode == "CSS1Compat")
{
windowHeight = document.documentElement.clientHeight;
} else
{
windowHeight = document.body.clientHeight;
}
return windowHeight;
}
window.onscroll = function()
{
if (ScrollTop() + WindowHeight() + 5 >= ScrollHeight())
{
More();
}
};

js滚动条的更多相关文章

  1. jquery.nicescroll.min.js滚动条使用方法

    jquery.nicescroll.min.js滚动条使用方法,Nicescroll 是制作自定义滚动条的jq插件.支持div,iframe,html等使用,兼容IE7-8,safari,firefo ...

  2. python实例编写(4)--js,滚动条,cookie,验证码,获取特定属性的元素,实现原理

    一.调用js 执行方法:execute_script(script,*args) 场景一:在页面上直接执行调用js 场景二:在定位的某个元素上执行调用js 如:掩藏文字(提示插件 tooltip设置淡 ...

  3. jquery.nicescroll.min.js滚动条插件的用法

    1.jquery.nicescroll.min.js源码 /* jquery.nicescroll 3.6.8 InuYaksa*2015 MIT http://nicescroll.areaaper ...

  4. JS滚动条下拉事件

    <script type="text/javascript"> window.onscroll = function(){ var t = document.docum ...

  5. JS——滚动条

    1.核心思想与之前的拖拽盒子是一样的 2.完全将鼠标在盒子中的坐标给滚动条是错的,因为这样会使滚动条顶部立刻瞬间移动到鼠标位置 3.必须在鼠标按下事件时记住鼠标在滚动条内部的坐标,再将鼠标在盒子中的坐 ...

  6. js 滚动条

    <script type="text/javascript"> //文档高度1016 包含隐藏的margin和padding 实际1000 //文档1000 //窗口高 ...

  7. JS 滚动条事件

    当滚动条滚动到最底部出发事件: $(window).scroll(function(){ if($(document).height()-$(this).scrollTop()-$(this).hei ...

  8. 原生JS滚动条位置处理

    // 滚动条位置 var scrollPosition = { // 位置 result: 0, // 监听位置 rememberPosition: function () { var type = ...

  9. js滚动条滚动到某个元素位置

    scrollTo(0,document.getElementById('xxx').offset().top);

随机推荐

  1. 有关app的一些小知识

    META相关 1. 添加到主屏后的标题(IOS)<meta name="apple-mobile-web-app-title" content="标题"& ...

  2. 获取table表格的一些不为人知的属性

    JS获取表格的简便方法:获取tbody:tBodies   获取thead:tHead   获取tfoot:tFoot   获取行tr:rows   获取列td:cells 使用实例: oTable. ...

  3. 转载:Ubuntu下deb包的安装方法

    转载:Ubuntu下deb包的安装方法,http://blog.csdn.net/kevinhg/article/details/5934462 deb是debian linus的安装格式,跟red ...

  4. SIM卡信息的管理

    MTK平台上,所有插入到手机中的SIM卡的信息都会存储在数据库com.android.providers.telephony中. 原始的数据库 图表 1 SimInfo数据表的结构 从上图示中,我们可 ...

  5. Html加载swf 兼容IE8 (含以下)显示

    嵌入参数说明: 1,AllowScriptAccess  参数: sameDomain:仅当 SWF 文件和网页位于同一域中时才允许执行外出脚本访问.这是 AVM2 内容的默认值----播放网络视频, ...

  6. yali项目的slider

    // 调用 var s41 = new slider({ target : '#slider411', titleActiveClass : 'j-active', itemActiveClass : ...

  7. 关于oracle数据库(9)

    内连接:从多张表中获取综合数据 inner join on select 表1.字段,表2.字段 from 表1 inner join 表2 on 关系; select 表1.*,表2.* from ...

  8. juniper防护墙接口的NAT和ROUTE模式如何选择问题

    juniper防护墙一般是把trust接口部署为NAT模式,untrust接口部署为route模式.这样当来自内部的数据访问Utrust区域时,会把源地址翻译成untrust接口的地址.从而达到隐藏内 ...

  9. 将网页中的html代码的table保存成word文件

    1.后台代码: string nowtime = DateTime.Now.ToString("yyyy-MM-dd"); Response.Clear(); Response.B ...

  10. JPA的介绍

    一.JPA概述 1.JPA是什么? JPA:Java Persistence API:用于对象持久化的 API,JPA是Java EE 5.0 平台标准的 ORM 规范, 使得应用程序以统一的方式访问 ...