hoch_oder_quer-handy-viewpoint.php
Quell Code
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
#orr {
display:none;
position:fixed;
width:100%;
height:100%;
left:0;
top:0;
background:red;
z-index:1999;
}
</style>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js"></script>
</head>
<body>
<div id="orr">Bitte drehen Sie Ihr Gerät!</div>
<script>
jQuery(function($) {
$('body').bind('orientationchange', function(e) {
check_orientation();
});
check_orientation();
});
var check_orientation = function() {
if(typeof window.orientation == 'undefined') {
$('#orr').html('Das ist kein Handy').css('display','block');
return true;
}
if(Math.abs(window.orientation) != 90) {
//portrait mode
$('#orr').fadeIn().bind('touchstart', function(e) {
e.preventDefault();
});
return false;
}
else {
//landscape mode
$('#orr').fadeOut();
return true;
}
};
</script>
</body>
</html>