Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #696940

    I am trying to change my background image at 700px and below on the top section of this page: http://marckdesignconcepts.com/Eloquent/

    It seems to work when I resize my browser, but when I open the page in my iPhone it does not show the correct background.

    Here is the code I am using:

    @media only screen and (max-width: 700px) {
    .topbackground{
    background-image: url(http://marckdesignconcepts.com/Eloquent/wp-content/uploads/2016/10/mobilebackground.jpg) !important;
    }

    }

    #697032

    Hey alex5252!

    I have loaded your web site with my iOS and I can see the same background image.
    Please disable any active cache, which will help you solve the issue.

    Thanks a lot

    Cheers!
    Basilis

    #697043

    Hey alex5252,

    Please try adding this code to the Quick CSS section under Enfold > General Styling or to your child themes style.css file:

    // color section background
    function colorsection_bg(){
    ?>
    <script>
    jQuery(window).load(function(){ 
        setTimeout(function() {
    	if (jQuery(window).width() < 768) {        	
               	jQuery(".topbackground").css({ 'background-image' : 'url(https://marckdesignconcepts.com/Eloquent/wp-content/uploads/2016/10/mobilebackground.jpg)' });     
    		} 
    	});
    	}, 1000);
    </script>
    <?php
    }
    add_action('wp_footer', 'colorsection_bg');
    

    Best regards,
    Vinay

    #697076

    I put that code in and it does not seem to have made any difference.

    #697170

    Hi,

    I think it would be easier if you created a new section to only show for mobile, and give your sections unique IDs so that you can hide/show them for the correct screen size using CSS:

    @media only screen and (min-width: 768px) {
     #section-desktop {
    display:block !important;
    }
     #section-phone {
    display:none !important;
    }
    }
    
    @media only screen and (max-width: 767px) {
     #section-desktop {
    display:none !important;
    }
     #section-phone {
    display:block !important;
    }
    }

    Regards,
    Rikard

    #697322

    That works. Thanks!

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Change section background image on mobile’ is closed to new replies.