How to use javascript conditionally like CSS3 media queries, orientation?
For Example I can write css for specific
@media only screen and (width : 10
...I want to run a javascript only if max-width of browser is 1900px and min-width is 768
EDIT: Actually, that was all wrong. If you're using a mobile device, use:
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;
}