Home > How to... > Script Library > Center thumbnail images vertically

Center thumbnail images vertically

<script> // Center thumbnail images vertically
$(document).ready( function() {
    $('.DataViewItemThumbnailImage div a img').each( function() {
 
    var thumbnail_div = $(this).parent().parent().height();
    var thumbnail_img = $(this).height();
 
    var margin = (thumbnail_div - thumbnail_img)/2;
 
        $(this).attr('style', 'margin-top: '+margin+'px !important');
         
    });
});
</script>


Translate and Localize your website with 'Localizer pluggin

Shopping Cart Software by Ashop