Image Orientation Detection (JS)
Detect whether a group of images are landscape or portrait and dynamically apply a related CSS class with JavaScript. Easily style portrait images one way, and landscape images another!
Works in modern browsers and IE9+
View the source of this page to see the HTML markup, CSS and JS.
![](_images/pic1.jpg)
![](_images/pic3.jpg)
More demos and snippets
Did you find this useful? There are more demos and code snippets this way.