will this code switch two different header images one for mobile sized screen one for desktop sized screen?
.home .site-header {
height: 262px;
background: url(“images/big.png”) no-repeat scroll 0 0 transparent;
}
.site-header {
max-width: 980px;
margin: 0 auto;
width: 100%;
height: 149px;
background: url(“images/small.png”) no-repeat scroll 0 0 transparent;
}
the logo itself is no background-image. For shrinking version you need a real image there :
you can change the logo by adding this to functions.php of your child-theme
if you want to have a different logo on mobile advices (even for ipad air etc)
function avia_custom_mobile_logo(){
if(wp_is_mobile()){
?>
<script>
jQuery(".logo img").attr("src", "http://path-to-mobile-logo/logo.png");
</script>
<?php
}
}
add_action('wp_footer', 'avia_custom_mobile_logo');
if you like to have a different logo for small screen width. – that is something different. – and on performance reasons it is always problematic to measure screen-width permanently. – so on this case a debouncing could be a good advice
function av_dif_mobile_logo(){
?>
<script>
jQuery(window).load(function(){
if (jQuery(window).width() < 480) {
jQuery(".logo img").attr("src", "http://path-to-logo/logo.png");}
});
</script>
<?php
}
add_action('wp_footer', 'av_dif_mobile_logo');
thanks works great. does seem to slow down the upload on mobile everything tests great