Attention, Zin 的交互设计之路。

User interface, user experience and interactive design.

« 自己认为最好,才是最好我在网易的微博 »

javascript与滚动条、Dom位置

滚动条上边缘位置,即文档页滚出浏览器上边缘的高度使用
IE7+,Firefox,Opera,Safari
在xhtml标准(html文档以<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">开头):

document.documentElement.scrollTop

在html标准下使用:

document.body.scrollTop

Chrome

document.body.scrollTop


浏览器可见区域高度
IE7+,Firefox,Opera,Chrome,Safari

document.documentElement.clientHeight;

  • 1金冈金冈2009-10-10 18:26:17
  • Thank you.
    嗯,还有,发现在ZBLOG社区里你写一篇帖子有点遗漏,地址:
    http://bbs.rainbowsoft.org/viewthread.php?tid=36524&amp;highlight=

    遗漏了你的ui.js里的ScrollTo句段,所以别人使用你介绍的方法时$(&quot;#divCommentPost&quot;).ScrollTo(400);没有效果。
  • 引用 回复TA

欢迎发表看法:

您的讨论更有价值!

© 2008 7thPark.com. Some rights reserved! Z-blog inside. 粤ICP备05035430号

返回页首