I have a directory site with an amazing homepage map, but unfortunately it doesn't load so well on mobile devices. The WordPress theme was setup to use a slider or map, but I'd like to display the slider on mobile devices and maps on desktops. I think this is the code to manipulate this:
<?php
////////////////////////////////////////
//// WHAT SLIDER ARE WE USING
////////////////////////////////////////
if(ddp('home_slider') == 'Map') {
get_template_part('includes/slider/markup', 'map');
} else {
if(function_exists('putRevSlider')) { putRevSlider(ddp('home_slider_alias')); } ?>
<script type="text/javascript">
jQuery(document).ready(function() { _sf_send_user_to_listings = true; });
</script>
<?php }
?>
I understand PHP has no concept of screen size. I also read once JavaScript or jQuery is mixed with the PHP, the server side stops all together and no more PHP can be processed. Perhaps my question - if I used CSS to display a slider on mobile devices, will the device still load the map behind the scenes? And vice versa, will the desktop load both a map and slider but only display one to the user? If the mobile devices are forced to load both, the crash will still occur from the map issue. (By the way, the developer wrote the map to process pins and clustering on the client side, so that's why it crashes apparently.)
If I can accomplish this using CSS, how would I go about changing the above PHP? I'm very new to PHP and server side programming all together. I'm assuming the ddp has something to do with the theme settings, because I'm currently able to select a map or slider (not both).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…