How to not run function if its a mobile device?

Posted by Deshiknaves on Stack Overflow See other posts from Stack Overflow or by Deshiknaves
Published on 2010-04-24T01:37:28Z Indexed on 2010/04/24 1:43 UTC
Read the original article Hit count: 325

I have a modal pop up function on my website, but i don't want this to run if the browser is smaller than 480px. I have found that if I put an if statement such as:

if (window.innerWidth && window.innerWidth > 480) {

 run function()
}

Then it should run only if the browsers innerWidth is > 480. However its not working and I think its because I have page scaling on this website. Can any one help me with a conditional statement if page scaling is on? Thanks.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about iphone