dimsemenov / Magnific-Popup

Light and responsive lightbox script with focus on performance.
http://dimsemenov.com/plugins/magnific-popup/
MIT License
11.39k stars 3.48k forks source link

VerticalFIt doesn't take in consideration caption / title #671

Open matjazu opened 9 years ago

matjazu commented 9 years ago

Hey,

first I must say very good job on this jquery plugin :)

I came across a problem where verticalFit doesn't take in consideration caption / title. Therefore i tried with a workaround, but it wasn't what I was looking for. My current workaround works through callback and verticalFit on true.

 callbacks: {
     updateStatus: function(data) {

         if(data.status === 'ready') {
         var imageHeight = parseInt($('.mfp-img').css('max-height'));
         var titleHeight = parseInt($('.mfp-title').height());
         var newHeight = imageHeight-titleHeight;
         $('.mfp-img').css('max-height', newHeight);
         }
      }
 }

But when i change the image in gallery, immediate recalculation of height is visible and image jumps after a few milliseconds.

Is there a better way to recalculate and change max-height so that it will take in consideration also mfp-title but there will be no visible feedback?

chithract commented 5 years ago

@matjazu Have you found a solution/fix for this?

matjazu commented 5 years ago

@chithract I do not remember and I do not find this anywhere in old code. So sry I can not give you any more info regarding this.

chithract commented 5 years ago

@matjazu I found a solution with https://github.com/dimsemenov/Magnific-Popup/issues/843. Thanks for your reply.