获取元素高度 scrollWidth //显示当前元素的宽度 scrollHeight //显示当前元素的高度 scrollLeft //显示当前元素的左边距左侧的距离 scrollTop //显示当前元素的顶部距顶部的高度 window.innerHeight - 浏览器窗口的...
分类:
其他好文 时间:
2015-11-25 00:21:10
阅读次数:
193
jquery获取文档高度和窗口高度,$(document).height()、$(window).height()$(document).height():整个网页的文档高度$(window).height():浏览器可视窗口的高度$(window).scrollTop():浏览器可视窗口顶端距离网...
分类:
Web程序 时间:
2015-11-23 22:04:27
阅读次数:
258
十五个常用的jquery代码段 回到顶部按钮通过使用 jQuery 中的animate和scrollTop方法,你无需插件便可创建一个简单地回到顶部动画:1 // Back to top2 $('a.top').click(function (e) {3 e.preventDefault();4.....
分类:
Web程序 时间:
2015-11-19 16:41:34
阅读次数:
218
对于onscroll事件的支持各浏览器 document、document.body、document.documentElement 对象的 onscroll 事件的支持存在差异。所谓的支持性存在差异就是我们常说的浏览器兼容性问题,就是说,对于不同浏览器可能不会按照预期触发相应的事件处理函数。IE...
分类:
其他好文 时间:
2015-11-18 12:21:45
阅读次数:
152
//判断页面滚动到顶部和底部 $(window).scroll(function(){ var doc_height = $(document).height(); var scroll_top = $(document).scrollTop(); ...
分类:
移动开发 时间:
2015-11-17 18:58:57
阅读次数:
187
document.body.scrollTop与document.documentElement.scrollTop两者有个特点,就是同时只会有一个值生效。比如document.body.scrollTop能取到值的时候,document.documentElement.scrollTop就会始终为...
分类:
Web程序 时间:
2015-11-16 19:43:06
阅读次数:
289
【译】前端开发者都应知道的 jQuery 小技巧回到顶部按钮通过使用 jQuery 中的animate和scrollTop方法,你无需插件便可创建一个简单地回到顶部动画:1 // Back to top2 $('a.top').click(function (e) {3 e.preventDef.....
分类:
其他好文 时间:
2015-11-15 13:28:47
阅读次数:
192
滚动到顶部$('.scroll_top').click(function(){$('html,body').animate({scrollTop:'0px'},800);});滚动到指定位置$('.scroll_a').click(function(){$('html,body').animate(...
分类:
Web程序 时间:
2015-11-14 19:22:05
阅读次数:
286
//1.页面滚动加载 $(document).ready(function () { //本人习惯这样写了 ??? $(window).scroll(function () { ??????? //$(window).scrollTop()这个方法是当前滚动条滚动的距离 ??????? //$(wi...
分类:
其他好文 时间:
2015-11-14 15:14:59
阅读次数:
279
这里有一个方法可以将DIV的滚动条滚动到其子元素所在的位置,方便自动定位。var container = $('div'), inner = $('#inner');container.scrollTop( inner.offset().top - container.offset()....
分类:
Web程序 时间:
2015-11-13 15:55:04
阅读次数:
221