I am wondering if there is a way to use media queries in javascript like i use it in CSS ? i want to handle device-width or orientation and fire a fun
Check out Responsive JavaScript. Sounds like it will do what you're looking for.