JS实时监听浏览器宽度的变化

2019-04-18  本文已影响0人  LIsPeri

clientHeight:function(){
//加载页面时执行一次
changeHeight();
//监听浏览器宽度的改变
window.onresize = function(){
changeHeight();
};

function changeHeight(){
    //获取网页可见区域宽度
    var docHeight =  document.documentElement.clientHeight;
    if(docHeight <= 750){
        $('.login-bottom-banner').hide();
        $('.login-bottom-banner-text').hide();
    }else {
        $('.login-bottom-banner').show();
        $('.login-bottom-banner-text').show();
    }
}

},

上一篇下一篇

猜你喜欢

热点阅读