• Resolved carobina

    (@carobina)


    Hi, I am using some php to use the featured image as a kind of page hero, with navigation above. But when using the Customizer to view the results on mobile, the mobile breakpoints seem to have shifted. If I use the ones on the GeneratePress website https://docs.generatepress.com/article/responsive-display/
    the tablet reacts to the css of the smartphone mode, but if I shift the breakpoints to “max 668” and “min 669 to max 1024”, the tablet in the customizer reacts to it’s CSS.

    However, I don’t want to change the breakpoints just because the customizer does not work as I had expected. Does anybody have an idea what is going on, or which setting could be the culprit?

    I am not aware of any CSS or any other snippets that might have changed my breakpoints…

    Here’s the code (which Tom and Leo helped to put up a few years ago):

    add_action( 'wp_head', function() {
        $image = get_the_post_thumbnail_url( get_the_ID() );
    	$posttype = get_post_type ( get_the_ID() );
    
        if ( !empty($image) && $posttype == 'page' ) {
    	?>
    	    <style>
    		.featured-image {
          		    display: none;
    		}
    				
    		.site-header {background-image: url( '<?php echo $image; ?>' );}
    
    		.inside-header {
    		    padding: 420px;
    		}
    
    		.site-header {
    		    background-size: cover;
    		    background-repeat: no-repeat;
    		    background-position: center center;
    		}
    
    		@media (min-width: 769px) and (max-width: 1024px) {
    		    .inside-header {
    			padding: 270px;
    		    }
    		}
    
    		@media (max-width: 768px) {
    		    .inside-header {
    			padding: 90px;
    		    }
    		}
    
    	    </style>
    	<?php
        }
    } );

    Thanks for anyone helping out!

    • This topic was modified 1 year, 9 months ago by carobina.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi there,

    the simple solution is to ignore the Customizer > Preview for this, as its never been accurate.

    If you need to test for mobile responsiveness use the Browser Developers Tools to check.

    Thread Starter carobina

    (@carobina)

    Ahh *lightbulb*

    Thanks so much, David, for the quick response!

    And good to know for the future ??

    You’re welcome

    Thread Starter carobina

    (@carobina)

    For anyone reading this, because researching what Browser Developers tools are took me quite a while (since most of them address css and stuff, which I knew already): “firefox responsive design mode” helped me.

    On firefox one can get into responsive design mode by Ctrl + Shift + M. Then one can choose different tablet and smartphone types, make up dimensions yourself and toggle between portrait and landscape mode.

    Thanks for taking the time to provide some info ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Responsive Breakpoints shifted in Customizer?’ is closed to new replies.