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.69k stars 299 forks source link

Responsive breakpoint rowheight #92

Open ghost opened 9 years ago

ghost commented 9 years ago

I would like to see the ability to add a different rowheight for each of the breakpoints I work with. 150px is good for 1200px but not 320px.

ghost commented 9 years ago

I was able to get this done with some (window).width if statements.

klihelp commented 9 years ago

+1

santiquiss commented 9 years ago

+1

miromannino commented 9 years ago

Yes, that's can be done with a single call to justified gallery when a resize is done. I prepare you a simple example to put it into the official documentation. Thank you

elemis commented 9 years ago

Could you please provide an example on how to add different rowheights for different breakpoints? Thank you

bradvin commented 8 years ago

hey @miromannino - have you put this example in the official docs yet? I cannot find it

thanks for any help

tomkeysers commented 8 years ago

+1 for the docs update ;)

My take on it:

    doTheGrid(); // runs on doc ready
    $(window).resize(function() {
      doTheGrid();
    });

    function doTheGrid() {
      var w = $(window).width();
      if( w > 991 ) {
        rowH = 270;
      } else {
        rowH = 200;
      }
      // console.log(rowH);

      $("#inspirations").justifiedGallery({
        selector: 'a.inspirations-item',
        rowHeight: rowH,
        randomize: false,
        margins: 5,
        captions: false
      });
    }