Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1419171

    Dear Kriesi Team,

    my client would like to display his content in two columns, e.g. with text left (and coloured background) and picture right. The height of the two columns should be equal, the right margin of the picture to the screen border should be zero and the picture should on all times fill out the complete height (i.e. when simulating this in your browser, the picture should automatically adapt to fulfill this, i.e. zoom in/out a bit).

    For example, see the sections on this external website:
    https://www.standardhotels.com/london/properties/london?gad=1&gclid=EAIaIQobChMI7PD00Y-qgQMVlFBBAh1lsAsFEAAYASAAEgL_o_D_BwE

    I have tried to replicate this effect (see URL in private content), both with a “Farb-Sektion” and a “Rasterzeile”, but both are not satisfying to me, esp. because the picture does not adapt with the screen size and with the Farb-Sektion” there is a margin right of the picture with respect to the screen border. (Sorry for not being able to technically express myself better.)

    Hope you can give me some suggestions. Which section type is better? What settings does the picture or picture-column need to have? How to get rid of the space between picture and screen border when using Farb-Sektion?

    Thanks in advance!

    Best regards, Cornelie

    #1419343

    Hey CJGVD,
    Thank you for your patience, in your grid row element example it look like to have added an image element inside of the grid element, instead try adding the image as a background image to the grid and set the Background Image Position as center center
    Enfold_Support_3270.jpeg
    on my test page I set each grid row element as 50% of the height and the image fills the cell size:
    Enfold_Support_3272.jpeg
    the only issue is the when the grid becomes a single column at mobile the cells with the background image have no content so the height doesn’t match as the equal height is not applied:
    Enfold_Support_3274.jpeg
    To correct I added the custom class equal-height-mobile-grid to the grid row elements, my test page has three:
    Enfold_Support_3276.jpeg
    and added this code to the end of my child theme functions.php file in Appearance ▸ Editor:

    function grid_row_elements_equal_height_for_mobile() { ?>
      <script>
    window.addEventListener('DOMContentLoaded', function() {
      (function($){
      	var width = $(window).width();
      	if (width < 767) {
        $('.equal-height-mobile-grid').each(function(){  
         var $columns = $('.flex_cell .flex_cell_inner',this);
         var maxHeight = Math.max.apply(Math, $columns.map(function(){
             return $(this).height();
         }).get());
         $columns.attr('style', 'height: '+ maxHeight +'px !important');
      });
      	} else {}
      })(jQuery);
    });
    </script>
      <?php
    }
    add_action('wp_footer', 'grid_row_elements_equal_height_for_mobile', 99);

    and now on mobile the image cell is equal height:
    Enfold_Support_3278.jpeg
    Please give this a try.

    Best regards,
    Mike

    #1419455

    Dear Mike,

    thanks for your very helpful reply!

    All seems to work on my page. The only thing that I did not implement was to set each grid row element as 50% of the height. I want the “text column” to determine the height and the “picture column” should just adapt to it. Is it then right to NOT set any height limits on each grid row element?

    The extra code for functions.php seems good to me as it works. And it is not related to setting the height to 50%, am I right?

    So to replicate the layout of this previously mentioned hotel site, it is best to use grid rows (Rasterzeile) and not colour sections (Farbsektion), am I right?

    Thanks again and best regards,
    CJGVD

    #1419456

    Hi,

    Thank you for the update.

    Is it then right to NOT set any height limits on each grid row element?

    Yes, that’s correct. Don’t set a maximum height if you want the container to adjust based on the content’s length.

    The extra code for functions.php seems good to me as it works. And it is not related to setting the height to 50%, am I right?

    The script retrieves the height of the tallest column or cell in the container and applies this height value to the others

    So to replicate the layout of this previously mentioned hotel site, it is best to use grid rows (Rasterzeile) and not colour sections (Farbsektion), am I right?

    Yes, use the Grid Row element with its cell-based containers instead of the Color Section and Column elements.

    Best regards,
    Ismael

    #1419457

    Dear Ismael, thanks for your quick reply! All is settled and clear now.
    You can close this thread. Thanks again and have a nice day!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Responsive behaviour of picture to cover column height at all times’ is closed to new replies.