Jquery text-align center with lightbox onclick

another issue.

I want to add text-align center to the wrap that covers the images when the height is bigger than the width and viceversa. I achieve it but it adds it to the next element.

jQuery('.work-preview .next').click(function(e){
 var imgW = $('.work-preview .frame img').width();
var imgH = $('.work-preview .frame img').height();

if(imgW > imgH){

    $('.work-preview .frame').css('text-align', 'right');
 else {$('.work-preview .frame').css('text-align', 'center');}

here the website: http://donarnold.com.au/