Is there a way using JavaScript to hi开发者_如何学Pythonde a div element, when the iphone changes to portrait mode?
@media all and (orientation:portrait){
#divID {
display: none;
}
}
Pop that in your CSS ;-)
you could do a lil js "trick":
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";
}
}
精彩评论