2010-12-07 8 views
0

아이폰이 세로 모드로 변경되면 JavaScript를 사용하여 div 요소를 숨기는 방법이 있습니까? 당신의 CSS ;-)iPhone 방향 HTML 숨기기

+0

하나, [이전 질문] (http://stackoverflow.com/questions/2323281/can-js-jquery-determine-the-orientation-of-the-phone), 빠른 읽을만한 가치가 있습니다. –

답변

1
@media all and (orientation:portrait){ 
    #divID { 
     display: none; 
    } 
} 

팝 : 내 자신의

var elem = document.getElementById('elemID'); 
window.onorientationchange = function(){ 
    if(document.body.offsetWidth == 960){ //don't remember the best way to retrieve body width atm 
     elem.style.display = "none";  
    }else{ 
     elem.style.display = "block"; 
    } 
} 
0

당신이 릴 JS "속임수"를 할 수