$ ('body'). Css ('overflow-y', 'auto') не работает в Internet Explorer

Я пытаюсь изменить поведение браузера в зависимости от высоты окна. Я хочу если пользователь находится на нетбуке, мой скрипт просто активирует css overflow-y на «auto», поэтому, если контент больше, чем экран, пользователь может видеть все. если пользователь находится на большом экране, я хочу, чтобы переполнение было скрыто, и просто мой основной div был с overflow = 'auto', чтобы нижний колонтитул мог быть внизу экрана, но содержимое также можно было просматривать, если оно больше экрана.

публикуя базовый код для этого, он работает на больших экранах на Mac, но в Internet Explorer - нет, ни на больших, ни на маленьких экранах ...

что делать?

Заранее спасибо за помощь

CSS

html, body {
    min-width: 600px;
    margin: 0;
    padding: 0;
    overflow: hidden;
}
#header {
    position:relative;  /* IE7 overflow bug */
    clear:both;
    float:left;
    width:100%;
    height: 200px;
    overflow: hidden;
}
#main {
    position:relative;  /* IE7 overflow bug */
    clear:both;
    float:left;
    width:100%;
    overflow-x: hidden;
}
#footer {
    position:relative;  /* IE7 overflow bug */
    clear:both;
    float:left;
    width:100%;
    height: 100px;
    overflow: hidden;
}

jQuery

if( typeof( window.innerWidth ) == 'number' ) {
    // No-IE
    var screen_height = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6 +
    var screen_height = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4
    var screen_height = document.body.clientHeight;
}

var header_height = $('#header').height();
var footer_height = $('#footer').height();
var main_height = screen_height - header_height - footer_height;
//
if (navigator.userAgent.toLowerCase().search("iphone") > -1 || navigator.userAgent.toLowerCase().search("ipod") > -1) {
    $('body').css('overflow-y', 'auto');
} else {
    if(screen_height > 550) {
        $('#main').css('height', main_height + 'px');
$('#main').css('overflow-y', 'auto');
    } else {
        $('html, body').css('overflow-y', 'auto');
    }
}
21
задан Pluda 25 April 2011 в 13:31
поделиться