php - Can't get if-else statement to work while detecting screen resolution -
i'm making separate navigation bar on site handheld devices, i've come php script detects resolution , should output different navigation bars accordingly.
i'm not php yet, , took me while come rather simple script:
<?php if ($(window).width() < 764) : ?> <p>mobile navigation</p> <?php else : ?> <p>normal navigation</p> <?php endif; ?> when use this, page not load within or beneath code, neither rest of page. i'd grateful if help.
thanks!
i think you're looking css media queries.
<style> #mobilenavigation { display: none; } @media (max-width: 480px) { #mobilenavigation { display: block; } #desktopnavigation { display: none; } } </style> <div id="mobilenavigation">mobile users see this</div> <div id="desktopnavigation">desktop users see this</div> now, need little more thinking , designing, because you'll want entire site mobile friendly , responsive.
Comments
Post a Comment