if you open this website on your mobile phone in portrait mode:
You get what seems to be an Overlay notifying you that you have to rotate your device in order to view the website properly.
How is this basically realized by CSS / HTML or Plugins?
if you open this website on your mobile phone in portrait mode:
You get what seems to be an Overlay notifying you that you have to rotate your device in order to view the website properly.
How is this basically realized by CSS / HTML or Plugins?
I'm not sure exactly how that site does it, as i'm on mobile, so no devtools. ;)
But it's easy enough using JavaScript to check whether the height is greater than the width, a signature of portrait mode.
if (window.innerHeight > window.innerWidth) // display the overlay
demo - http://jsfiddle.net/victor_007/4862j3ne/1/
you can use a @media queries
to detect the width and show the div
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
div{display:block}
}
I used this to adjust images on a mobile version of a small website when changed to and from landscape mode:
$(window).on('resize orientationchange', function () {})
2 different events due to differences in browsers (theres a few more Im sure)
Please use below snippet of code. I hope this will work..
if(window.innerHeight > window.innerWidth){
if(window.innerHeight < "600"){
alert("Please use landscape!");
}
}
Thanks