获取浏览器可视区域大小方法

function getInner(){
    if(typeof window.innerWidth != 'undefined'){
        //支持现代浏览器
        return {
            width:window.innerWidth,
            height:window.innerHeight
        }
    }else{
        //支持ie6等低版本浏览器
        return {
            width:document.documentElement.clientWidth,
            height:document.documentElement.clientHeight
        }
    }
}

在firefox低版本的浏览器中可能会出现获取宽度问题

把滚动条宽度去除顾用这个兼容版本获取浏览器的可视区宽度

posted @ 2013-05-31 09:25  抱.抱  阅读(225)  评论(0编辑  收藏  举报