现在的位置: 首页 > 综合 > 正文

(转)跨浏览器获取滚动条高度

2013年10月22日 ⁄ 综合 ⁄ 共 384字 ⁄ 字号 评论关闭

var w3c = (document.getElementById) ? true : false;
var agt =
navigator.userAgent.toLowerCase();
var ie = ((agt.indexOf("msie") !=
-1) && (agt.indexOf("opera") == -1) &&
(agt.indexOf("omniweb") == -1));

 

function IeTrueBody() {
    return (document.compatMode &&
document.compatMode != "BackCompat") ? document.documentElement :
document.body;
}

 

function GetScrollTop() {
    return ie ? IeTrueBody().scrollTop :
window.pageYOffset;
}

抱歉!评论已关闭.