Created
April 3, 2014 09:26
-
-
Save tahirm/9951286 to your computer and use it in GitHub Desktop.
Find size and orientation of current media (like media-queries in css). #js #media-query #css
From http://stackoverflow.com/questions/7625718/how-to-use-javascript-conditionally-like-css3-media-queries-orientation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doStuff(){ | |
landscape = window.orientation? window.orientation=='landscape' : true; | |
if(landscape && window.innerWidth<1900 && window.innerWidth > 768){ | |
//code here | |
} | |
} | |
window.onload=window.onresize=doStuff; | |
if(window.onorientationchange){ | |
window.onorientationchange=doStuff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment