Skip to content

Commit

Permalink
Orientation only to landscape in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
ayush-raj13 committed Jul 10, 2023
1 parent 5065bba commit b637faa
Showing 1 changed file with 44 additions and 1 deletion.
45 changes: 44 additions & 1 deletion client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,51 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style type="text/css">
#landscape{
position: absolute;
top: 0px;
left: 0px;
background: #000000;
width: 100%;
height: 100%;
display: none;
z-index: 20000;
opacity: 0.9;
margin:0 auto;
}
#landscape div{

color: #FFFFFF;
opacity: 1;
top: 50%;
position: absolute;
text-align: center;
display: inline-block;
width: 100%;
}
</style>
<script>
function doOnOrientationChange()
{
switch(screen.orientation.type)
{
case 'portrait-primary':
document.getElementById("landscape").style.display="block";
break;
default:
document.getElementById("landscape").style.display="none";
break;
}
}

//Listen to orientation change
window.addEventListener('orientationchange', doOnOrientationChange);

</script>
</head>
<body>
<body onload="doOnOrientationChange();">
<div id="landscape"><div>"Rotate Device to Landscape"</div></div>
<div id="root"></div>
<div class="modal-container"></div>
</body>
Expand Down

0 comments on commit b637faa

Please sign in to comment.