Fit Lightbox container in window if image is larger
- by Bobe
I'm just looking for a simple way to set the max width and height of the Lightbox container and image based on the window size if the image is larger than the current window size.
So say the image is 2000x1200 and the window is 1280x1024, then the max-height and max-width of div.lb-outerContainer and img.lb-image should be set to
$(window).height() - 286, $(window).width() - 60
and
$(window).height() - 306, $(window).width() - 80
respectively.
I'm just having a bit of trouble determining where to go about implementing these rules. Do I do it in the lightbox.js file? If so, where? Would it be acceptable to just throw in some script on the page it's used on?