php - load div only for mobile devices with javascript -
is possible load div if mobile detected or if resolution lower 641px? have different menus desktop , mobile. mobile menu uses image svg sprite, desktop don't want svg image load save http request. can hide div based on media queries, how can @ least prevent image being loaded, or load intire menu div mobile? best approach this?
https://code.google.com/p/php-mobile-detect/wiki/mobile_detect
check above link, can use in if else statement show hide div on basis of device type
<?php // written adam khoury @ developphp.com - march 26, 2010 // php swapping css style sheets target device layouts // make index page of site .php file instead of .html $stylesheet = "default.css"; $agent = $_server['http_user_agent']; // put browser name local variable if (preg_match("/iphone/", $agent)) { // apple iphone device // set style sheet variable value target iphone style sheet $stylesheet = "iphone.css"; } else if (preg_match("/android/", $agent)) { // google device using android os // set style sheet variable value target android style sheet $stylesheet = "android.css"; } ?>
above code taken http://www.developphp.com/view_lesson.php?v=310, check complete code if want.
Comments
Post a Comment