Giter Club home page Giter Club logo

image-masonry's Introduction

image-masonry

A responsive justified image layout grid which maintains image aspect ratios with no trailing or incomplete last row. Best possible layout found by creating a graph of all possible row combinations and finding the shortest path through the graph using a target row height as the basis for weight / cost of each graph node.


Examples


Screenshot

alt text

image-masonry's People

Contributors

fergaldoyle avatar

Stargazers

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

Watchers

 avatar  avatar

image-masonry's Issues

Publish to npm

Hey thanks for the awesome library! Would it be possible to publish a built version to NPM? Right now it seems there's no real easy way to actually use image-masonry in a project.

How to wrap the component in grid

Hi, the project is pretty impressive.
However, I find difficulties at wrapping it inside a grid, for example like below:

.grid-container {
  display: grid;
  grid-template-columns: 0.4fr 2.3fr 0.3fr;
  grid-template-rows: 0.4fr 2.2fr 0.4fr;
  gap: 0px 0px;
  grid-template-areas:
    ". . ."
    ". images ."
    ". . .";
}

.images { grid-area: images; }

and later:

<div class="grid-container">
  <div class="images">
      <ImageMasonry {images} {targetRowHeight} on:image-click={onClick} let:image >
      <div class="image-overlay">
        <div class="image-text">{image.title}</div>
      </div>
    </ImageMasonry>
  </div>
</div>

The does not scale down along the grid. in such a case. Is there any way to achieve that? (this is Svelte btw)

Uncaught exception in Dijsktra algorithm

Occasionally the following error is thrown when targetRowHeight is increased for the first time (by changing a bound variable)

Uncaught (in promise) Error: Could not find a path from 0 to 30.
    at Object.single_source_shortest_paths (dijkstra.js:86)
    at Object.find_path (dijkstra.js:106)
    at default (justified-layout.js:60)
    at Object.$$self.$$.update (ImageMasonry.svelte.js:437)
    at update (internal.js:760)
    at flush (internal.js:732)

It is a Svelte version.

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.