miromannino / Justified-Gallery

Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
http://miromannino.github.io/Justified-Gallery/
MIT License
1.68k stars 299 forks source link

Main wrapper "padding" issue #296

Closed test3be closed 4 years ago

test3be commented 5 years ago

Hi,

Have an issue regarding the main gallery wrapper and i cant get rid of it. As you can see on the screenshot, there is a sort of spacing around the images. I've put a red background on this container to make it more clear. Please see screenshot.

i"m loading: https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.7.0/css/justifiedGallery.min.css https://cdnjs.cloudflare.com/ajax/libs/justifiedGallery/3.7.0/js/jquery.justifiedGallery.min.js (before <

screen shot 2018-12-07 at 08 35 51

/body>)

My js Init:

$(".photo-gallery").justifiedGallery({ rowHeight: 200, //lastRow: 'justify', margins: 10, image: { titleSrc: function(item) { return item.el.attr('title') ; } } });

Thanks for your help

biziclop commented 5 years ago

Hi, until a better solution, you could experiment wrapping your .photo-gallery like this:

<div style="background: red; overflow: hidden;">
  <div style="margin: -10px;">
    <div class="photo-gallery justified-gallery">
jefftucker1952 commented 5 years ago

And if you just want to eliminate all spacing between images, set "margins" to zero.

Nebel54 commented 5 years ago

I just had the same problem and it took me some time to understand the documentation correctly. You need to set border: 0 to remove those borders:

$('.justified-gallery')
    .justifiedGallery({
      margins: 10,
      border: 0
    });