Giter VIP home page Giter VIP logo

vanilla-masonry's Introduction

Vanilla Masonry

This project is now deprecated. Masonry v3 supports vanilla JS, without requiring jQuery. Use it!


Masonry is a dynamic grid layout script. Think of it as the flip-side of CSS floats. Whereas floating arranges elements horizontally then vertically, Masonry arranges elements vertically, positioning each element in the next open spot in the grid. The result minimizes vertical gaps between elements of varying height, just like a mason fitting stones in a wall.

You might have heard of jQuery Masonry, this is the framework-free version.

This package has all the documentation and demos to get you started.

View this project live at http://vanilla-masonry.desandro.com.

Viewing this project locally

Via download

You can download a zip of all the flat HTML files from http://meta.metafizzy.co/files/vanilla-masonry-site.zip.

Via Jekyll

The documentation and demo pages are generated using Jekyll. With Jekyll installed, you can clone this repo and run Jekyll from Terminal:

git clone https://github.com/desandro/vanilla-masonry.git
cd masonry/
jekyll --server --auto

Then view the live site at http://localhost:4000.


Copyright (c) 2011 David DeSandro

vanilla-masonry's People

Contributors

calvein avatar desandro avatar jonathanong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vanilla-masonry's Issues

Masonry with variable Height

Hello,

I'm making a web page with vanilla masonry and variable Height (collapsible content), when the content is collapsed, masonry is working, but when I expand it, it push the content, and the others items.
Ps : when i expand it, the style goes directly in the div attribut.
is there a way in Js to put it directly in the css ?

How to get the container by a class?

Hi,

Great to be able to use this. I want it to be used in a drupal web site. I am not controlling the way drupal outputs the content (or at least I don't want to dig in that much). I want to be able to use this:

<script src="https://raw.github.com/desandro/vanilla-masonry/master/masonry.min.js"></script> <script> window.onload = function() { var wall = new Masonry( document.getElementById('THIS-SHOULD-BE-A-CLASS'), { // dynamically set column width to 1/5 the width of the container columnWidth: function( containerWidth ) { return containerWidth / 3; } }); }; </script>

How could I get the element by it's class instead of ID? Searched all over the internet but, seams no native support is available for any. Can you help me understand how it operates (and by the way, put an example with a class as a container in the main web site).

Thanks,
NR

modal window not trigger in pages appended when using masonry

I don't know what am I doing wrong. I have a site with masonry used and appending pages. The modal window works fine on the first page and individually when i call the 2nd page direct but when it appends using infinite scroll it doesnt work.

this is the first page http://www.spheretekk.com/ych/media-videos.html

this is the second page http://www.spheretekk.com/ych/2.html

Title with 'this modal window doesnt work'..when click on image it doesn't open a modal

Can you please let me know what am I doing wrong

Thank you

Masonry and Infinite Scroll Not Working On Tumblr

Here is my complete code:

<title>{Title}</title> {block:Description}{/block:Description} <script src="http://code.jquery.com/jquery-1.6.1.min.js"></script>

{block:IndexPage}

<script src='http://dl.dropbox.com/u/10308294/js/jquery.masonry2-0.min.js' type='text/javascript'></script> <script type="text/javascript" src="http://dl.dropbox.com/u/10308294/un/jquery.infinitescroll.min.js"></script>

{/block:IndexPage}

<style type="text/css"> body{ overflow-x:hidden; background:{color:Background} url('{image:background}') fixed; font-family:{font:Body}; font-size:10px; letter-spacing:0px; color:{color:text}; } a:link, a:visited{ color:{color:links}; text-decoration:none; } a:hover{ color:{color:hover}; text-decoration:none; } img a{ border:0px !important; } #container{ {block:IndexPage} {block:IfTwoColumns}width:900px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:900px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage} width:500px;{/block:PermalinkPage} margin:0 auto; background:{color:PostsBackground}; } #infscr-loading { z-index: 5000; position: fixed; left: 41%; bottom: 40px; width: 200px; padding: 10px; background: #000; opacity: 0.8; color: #FFF; text-align:center; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; {block:IfNotUseLoadingBox}display:none !important;{/block:IfNotUseLoadingBox} } #description{ padding:2px; width:880px; {block:PermalinkPage}width:480px;{/block:PermalinkPage} } .nav{ font-size:9px; font-weight:bold; padding:20px; } .description{ padding-top:15px; font-size:10px; } .description h1{ font-family:{font:Title}; color:{color:title}; font-weight:400; font-size:20px; text-align:center; } #footer{ clear:both; } #posts{ margin:0 auto; {block:IndexPage} {block:IfTwoColumns}width:900px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:900px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage} width:500px;{/block:PermalinkPage} background:{color:PostsBackground}; } .post{ {block:IndexPage} {block:IfTwoColumns}width:450px /**/{/block:IfTwoColumns} {block:IfNotTwoColumns}width:300px;{/block:IfNotTwoColumns} float:left; {/block:IndexPage} {block:PermalinkPage} {block:IfTwoColumns}width:480px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:480px;{/block:IfNotTwoColumns} {/block:PermalinkPage} margin-right:0px; margin-top:0px; background:{color:PostsBackground}; } .post h3{ font-weight:bold; font-size:11px; text-transform:uppercase; padding:5px; text-align:center; {block:IndexPage} {block:IfTwoColumns}width:410px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:260px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage} {block:IfTwoColumns}width:460px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:460px;{/block:IfNotTwoColumns} {/block:PermalinkPage} } .caption, .notestags{ padding:10px; {block:PermalinkPage} {block:IfTwoColumns}width:480px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:PermalinkPage} } .text{ padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:justify; } .container{ float:left; } .text img a{ border:0px !important; } .text img{ {block:IndexPage} {block:IfTwoColumns}max-width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}max-width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage}max-width:500px;{block:PermalinkPage} height:auto; border:0px !important; } .dunno{ background:{color:PostsBackground}; padding:10px; position:absolute; top:0; z-index:3; opacity:0; overflow:hidden; transition-duration: 0.8s; -webkit-transition-duration: 0.8s; -o-transition-duration: 0.8s; -moz-transition-duration: 0.8s; text-align:center; text-transform:uppercase; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage}display:none;{block:PermalinkPage} } .d_con{ } {block:IfMagnify} .photo:hover .dunno{ width:480px; opacity:0.85; overflow:hidden; transition-duration: 0.8s; -webkit-transition-duration: 0.8s; -o-transition-duration: 0.8s; -moz-transition-duration: 0.8s; } {/block:IfMagnify} .photo{ padding-bottom:-3px; width:auto; } {block:IndexPage}{block:IfMagnify}.photo:hover img{ position:relative; overflow: visible; width:500px; height:auto; transition-duration: 0.8s; -webkit-transition-duration: 0.8s; -o-transition-duration: 0.8s; -moz-transition-duration: 0.8s; z-index:2;} {/block:IfMagnify}{/block:IndexPage} .photo img{ {block:IndexPage} {block:IfTwoColumns}width:450px; /**/{/block:IfTwoColumns} {block:IfNotTwoColumns}width:300px;{/block:IfNotTwoColumns} {/block:IndexPage} {block:PermalinkPage}width:500px;{/block:PermalinkPage} height:auto; overflow: hidden; transition-duration: 0.8s; -webkit-transition-duration: 0.8s; -o-transition-duration: 0.8s; -moz-transition-duration: 0.8s; z-index:1; } .photoset_w{ padding:20px 0 10px 0 !important; {block:IfNotTwoColumns}width:300px;{/block:IfNotTwoColumns} {block:IfTwoColumns}width:450px;{/block:IfTwoColumns} } .photoset_w .html_photoset iframe{ margin-left:auto; margin-right:auto; display:block; } .link{ padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:justify; } .chat{ padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:justify; } .chat ul, .chat ul li{ list-style:none; margin:0px; padding:0px; } body { background-size: 100%; } .chat .label{ font-weight:bold; font-style:italic; text-transform:lowercase; } .quote{ font-size:15px; padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:left; } .qsource{ text-align:right; } .video embed, .video object, .video iframe{ {block:IndexPage} {block:IfTwoColumns}width:450px !important;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:300px !important;{/block:IfNotTwoColumns} {/block:IndexPage} height:auto !important; } .player{ padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:justify; } .audio_player{ background:#fff; } .audio { height:30px; overflow-y: hidden; } .audio span { color:#ffffff; font-size:1px; } .audio span a{ color:#ffffff; font-size:1px; } .artist{ text-transform:lowercase; padding:10px; text-align:center; {block:IndexPage} {block:IfTwoColumns}width:410px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:260px;{/block:IfNotTwoColumns} {/block:IndexPage} } .ask{ padding:10px; {block:IndexPage} {block:IfTwoColumns}width:430px;{/block:IfTwoColumns} {block:IfNotTwoColumns}width:280px;{/block:IfNotTwoColumns} {/block:IndexPage} text-align:justify; text-transform:lowercase; } .ask p{ margin-top:0px; } .title{ font-family: {font:Title}; font-size: 30px; color: {color:Title}; font-style: italic; padding: 10px; } div#header{ background: {color:Background}; {block:PermalinkPage}padding: 10px;{/block:PermalinkPage} text-align: center; width: 900px; } div#footer{ opacity: 0; filter: alpha(opacity = 0); background: {color:Background}; width: 900px; position: fixed; bottom: 0px; text-align: center; z-index: 1; } .source{ display:none; height:0px !important; } .p_separator{ border-top:1px solid {color:text}; padding-top:10px; margin:0 120px; } .p_meta{ text-align:center; text-transform:uppercase; font-size:10px !important; } .perma_pagi{ padding:10px 0; } {CustomCSS} </style> <script> var visible = 0; $(window).scroll(function() { if($(window).scrollTop()>="60") { if(visible == 0){ $("#footer").stop().fadeTo("medium", 1); visible = 1; } } else { if(visible == 1){ $("#footer").stop().fadeTo("medium", 0.0); visible = 0; } } }); </script>
{Title}
{block:Description}
{description}
{/block:Description}
Home • {block:AskEnabled}Message •{/block:AskEnabled} Archive {block:HasPages}{block:Pages} • {Label}{/block:Pages}{/block:HasPages} {block:SubmissionsEnabled} • {SubmitLabel}{/block:SubmissionsEnabled} • PersonalDreams

{block:Posts}
{block:Text}

{block:Title}

{Title}

{/block:Title}

{Body}

Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{/block:Text}

{block:Photo}

{block:IndexPage}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}
{/block:IndexPage}

{block:PermalinkPage}
{LinkOpenTag}<img src="{PhotoURL-500}" {PhotoAlt} border="0"/>{LinkCloseTag}
{block:Caption}

{Caption}
{/block:Caption} {/block:PermalinkPage}

{/block:Photo}

{block:Photoset}

{block:IfNotTwoColumns}{Photoset-250}{/block:IfNotTwoColumns} {block:IfTwoColumns}{Photoset-400}{/block:IfTwoColumns} {block:PermalinkPage} {block:Caption}
{Caption}
{/block:Caption} {/block:PermalinkPage}

{/block:Photoset}

{block:Quote}

"{Quote}" {block:Source}

{Source}

{/block:Source}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{/block:Quote}

{block:Link}

{Name}

{block:Description} {Description} {/block:Description}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{/block:Link}

{block:Chat}

{block:Title}

{Title}

{/block:Title}
    {block:Lines}
  • {block:Label} {Label} {/block:Label}

    {Line}

  • {/block:Lines}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{/block:Chat}

{block:Video}

{Video-500}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{block:PermalinkPage}
{block:Caption}

{Caption}
{/block:Caption} {/block:PermalinkPage}

{/block:Video}

{block:Audio}

{AudioPlayerWhite}
{block:Artist}{Artist}{/block:Artist} {block:TrackName}{TrackName}{/block:TrackName}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}
{block:PermalinkPage}{block:Caption}
{Caption}
{/block:Caption} {/block:PermalinkPage}

{/block:Audio}

{block:Answer}

{Asker} asked:

{Question}

{title} answered:{Answer}
Permalink {block:NoteCount} · {NoteCount} {/block:NoteCount}· {Timeago}

{/block:answer}

{block:PermalinkPage}

{block:PermalinkPagination} {block:PreviousPost} « Previous Post {/block:PreviousPost} | {block:NextPost} Next Post » {/block:NextPost} {/block:PermalinkPagination}
{block:NoteCount}{NoteCount} notes{/block:NoteCount} {block:HasTags} | {block:Tags}#{Tag} {/block:Tags} {/block:HasTags}
{block:ContentSource} {lang:Source}:{block:SourceLogo} {SourceTitle} {/block:SourceLogo}{block:NoSourceLogo}{SourceTitle}{/block:NoSourceLogo} {/block:ContentSource} {block:RebloggedFrom} {ReblogParentName} {/block:RebloggedFrom}

{/block:PermalinkPage}

{/block:Posts}

{block:PostNotes}{PostNotes}{/block:PostNotes}

and a live preview is available at govono.tumblr.com
Either masonry or infinite scrolling isn't working... and I am in desperate need of help. Please also remember I am a complete noob to codes and stuff, so really try to dumb it down for me.

Empty Slot in 198x198 Grid

Came up with this grid of 198 x 198 that I'm trying to use masonry on and I get a empty slot every so often. I was able to recreate the issue with jsFiddle:

http://jsfiddle.net/gC9hK/9/

Shouldn't the masonry fill that 198x198 space with one of the 198x198 bricks?

Thanks for the help.

-Pete

IE8 SCRIPT87: Invalid argument.

I'm getting a script error on the latest masonry (Masonry Vanilla) that breaks masonry, I'm getting Invalid argument on line 367 char 9

367: brick.style.top = ( minimumY + this.offset.y ) + 'px';

Char 9 is the first char on that line.¨

Any ideas of why?

Uncaught TypeError: Cannot call method 'appendChild' of undefined

A simple:
<script src="masonry.min.js"></script>

Or:
<script src="http://vanilla-masonry.desandro.com/masonry.min.js"></script>

Gives me
Uncaught TypeError: Cannot call method 'appendChild' of undefined
at
k = c.getElementsByTagName("body")[0],l = c.createElement("div"); l.style.marginTop = "1%",k.appendChild(l);

Under both Chrome and Firefox on Linux.
Whazzup?
I've got a body tag actually.

This is Vanilla Masonry v1.0.04

Non issue - Question about reordering?

Hello,

First, thank you for your work! It's fantastic.

I'm wondering if there is a way to let Masonry take over the order of the boxes in order to fit together without holes. Currently I have a layout that works well at most window sizes but then after a certain point it has one or two open spaces.... where a box could fit if allowed to move out of order. Any thoughts?

Thanks

IE 8 JS Error

Love the jQuery plugin and now the Vanilla plugin.

Found one little JS Error that occurs in IE 8:

IE 8 throws an error related to this line:
brick.style.top = ( minimumY + this.offset.y ) + 'px';

Exact error is:
Invalid argument.
Line:364, Char:5

Doesn't seem to affect functionality, but would love to have it fixed for cleanliness for IE8 users.

Thanks!

How is Vanilla Masonry licensed?

I'm interested in using this for a project, but our legal folks insist that we find out how it's licensed. Normally I would expect to find a LICENSE file, but there doesn't appear to be one. How is Vanilla Masonry licensed? Similar to jQuery (http://jquery.org/license)?

Thanks!

Corner Stamp?

Is it possible to use Corner Stamp, like jQuery Masonry?

If yes, can I have an example?

Simon

Layout needs to update colYs

layout(bricks) does some strange stuff if the colYs aren't updated. Adding something like:

var i = wall.cols;
wall.colYs = [];
while (i--) wall.colYs.push( 0 );

where wall is the instance before wall.layout(bricks); clears it all up.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.