Skip to content

Instantly share code, notes, and snippets.

@caratage
Created April 29, 2014 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save caratage/11402593 to your computer and use it in GitHub Desktop.
Save caratage/11402593 to your computer and use it in GitHub Desktop.
Check if image is in portrait or landscape orientation
var someImg = $("#someId");
if (someImg.width() > someImg.height()){
//it's a landscape
} else if (someImg.width() < someImg.height()){
//it's a portrait
} else {
//image width and height are equal, therefore it is square.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment