Aligning Latest News Images in Center!


#1

Hi,
Thanks for the wonderful theme. It is an awesome theme. I just need to know if there is any way. I can center the images in Latest News section. I have 5 images. First 3 are centered but last two are on the left.

Please provide a way to center them.

My website url : http://nenosystems.in/sunilbooks/


#2

Hello there,

Thank you for reaching out to us here.

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided code editor box

;(function($) {

  'use strict'

  if( $('.latest-news-area').length ){

    var getElem = $('.latest-news-area .blog-post:last-child');
    var ln = getElem.outerWidth()/2;
  
    $(window).on('load resize', function() {

      if ( matchMedia( 'only screen and (min-width: 992px)' ).matches ) {  
          getElem.prev().css({
            'margin-left': ln
          });
      }

      if ( matchMedia( 'only screen and (min-width:500px) and (max-width:991px)' ).matches ) {  
          getElem.css({
            'margin-left': ln
          });
      }

    });

  }

})(jQuery);    

  1. Update

Regards,
Kharis


#3

Hi Kharis,

Thank you so much for wonderful solution. You are amazing :slight_smile:

Regards
Priyanka


#4

You’re always welcome here! :slight_smile:

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis