Gutter Width on jQuery Masonry / Isotope not working

16,067

Solution 1

I have the same problem; I made a jsfiddle to test your example: http://jsfiddle.net/elektrorl/5W5HQ/

edit: http://isotope.metafizzy.co/docs/layout-modes.html#modified_layout_modes >> "Isotope’s methods can be extended and overwritten to shim-in additional functionality."

Solution 2

Changing gutterWidth by "gutter" worked for me:

$('#main-project-grid').isotope({
    masonry: {
        columnWidth: 313,
       "gutter": 10
    }
}); 
Share:
16,067
Jason Mayo
Author by

Jason Mayo

Design. Code. Cycling. Beats.

Updated on July 16, 2022

Comments

  • Jason Mayo
    Jason Mayo almost 2 years

    Im trying to get a Gutter Width of 10px between my Div's, but it doesn't seem to be applying. The Isotope script is working, because the items shuffle around and i have got a filtering navigation to work also.

    Im just struggling to get this Gutter! :(

    Heres the code:

        $('#main-project-grid').isotope({
            masonry: {
                columnWidth: 313,
                gutterWidth: 10
            }
        });
    

    And here's my HTML:

        <div class="container" id="main">
            <div class="container-content" id="main-grid">
    
                <div class="post-grid">
                    Box Item
                </div>
    
                <div class="post-grid">
                    Box Item
                </div>
    
                <div class="post-grid">
                    Box Item
                </div>
    
                <div class="post-grid">
                    Box Item
                </div>
    
                <div class="post-grid">
                    Box Item
                </div>
    
            </div>      
        </div>
    
  • Michael Giovanni Pumo
    Michael Giovanni Pumo over 11 years
    Thanks for that! Just what I was looking for too.
  • Denis
    Denis about 11 years
    what about gutterHeight? do you have any idea how to made this?
  • AfromanJ
    AfromanJ almost 11 years
    You just have to add a bottom margin (within the CSS) on your 'post-grid' classes for a vertical gutter.
  • Ben
    Ben almost 9 years
    wat? unlike gutterWidth, and contrary to the masonry docs, this actually works! thanks.
  • Tanner Hodges
    Tanner Hodges almost 9 years
    Wow, can't believe this actually worked. Haven't looked at the source to see why but thanks for the tip! Update: Looks like there is really obscure documentation on this. See masonry: gutter under Element Sizing and this CodePen for an example from the man himself.