I am trying to determine whether the user is viewing the website vertically or horizontally on their mobile device or iPad in order to adjust the image scale accordingly.
For example:
If the user is viewing the page horizontally, I want the image style to be set as follows:
img{width:100%; height:auto;}
But if the user is viewing the page vertically, the CSS for the image should be:
img{width:auto; height:100%;}
How can I achieve this functionality using jQuery, JavaScript, media queries, or any other method so that I can apply the appropriate style based on the user's viewing orientation on their mobile or iPad?
Thank you.