Answer the question
In order to leave comments, you need to log in
How to stretch image to fit modal window in fancybox?
The task is next.
There is an image slider. When you click on a slider image, the image opens in a modal window.
The peculiarity is that not all pictures are initially as large as you want.
Therefore, the task is to stretch insufficiently large pictures to the desired size, fixing, for example, the size of the modal window.
How can I do that?
Now fancybox is installed and working.
Answer the question
In order to leave comments, you need to log in
You can try this with a callback:
$(".fancy").fancybox({
afterShow: function () {
this.height = $(window).height();
this.width = 'auto'
}
});
Thanks for the answer.
It didn't work through the callback.
I coped with the forces of the css.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question