Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #946617

    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;
    }

    #946695

    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');
    #946722

    thanks works great. does seem to slow down the upload on mobile everything tests great

    #947637

    Hi,

    Great, glad you got it working. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.