Answer the question
In order to leave comments, you need to log in
JS lib or a plugin for beautiful docking of photo previews?
Hello.
I want to get about the same functionality in the gallery as here - piccsy.com
But I don’t really understand what to google at all. Is it really possible to do this on the frontend, or is it impossible to do without the backend?
The bottom line is that the user uploads photos with any aspect ratio, but I want to make it beautiful.
Answer the question
In order to leave comments, you need to log in
Let's say you take four photos, count the sum of their widths, divide by the width of the wrapper with future photos. ( +-margin ), you get a certain coefficient. After that, you start four divs in a row, each of which will store a photo, set the width of the div and the photo inside equal to "image width / our factor". You do not touch the height of the photo, but set the height of the div to a fixed one, on this site, for example, 480px, after that you check that the height of the photo is >=480px, otherwise you set its height to 480px, and the width to auto. Also set the div's overflow: hidden;. And here he is in a row. Pieces of photos in height will be cut off, as in principle it is done on this site. Well, you can still align the photo inside the block with margins.
Maybe there is a prettier way, or I made a mistake somewhere while explaining, but approximately according to this logic, I got quite nice rows. Unfortunately, I can't show you an example.
You can do this both on the front-end and on the back-end.
A. Sorry. They asked for a plugin.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question