I am wondering if something similar to this can be easily done in if/else PHP or Javascript. I have read about the usual ress techniques and I am trying to find a solution that doesn't rely on device detection like WURFL. Maybe what I am looking for is called "conditional loading"?
My goal is to only load the appropriate markup based on screen width exactly like a media query. For instance, I could create a full nav for larger screens and a simple more mobile friendly nav for smaller devices/screens. This would save tons of bandwidth and make the site truly flexible. Thanks for your input!
{ if < 768 }
some code here {html, php, etc}
{ / if}
{ if > 768 }
some code here {html, php, etc}
{ / if}
You can use element.clientWidth for device-width and window.screen.width. Another approach would be window.matchMedia, which is available in fairly every browser.