diff --git a/README.md b/README.md
index 0083539..3970f14 100644
--- a/README.md
+++ b/README.md
@@ -8,18 +8,18 @@ FlexMasonry is a lightweight, zero-dependency, masonry (cascading grid layout) l
## Features
-* **Lightweight** - Just 6KB of JS and CSS
-* **Fast** - Uses CSS flexbox for layout
-* **Responsive** - Show different number of columns at different breakpoints
-* **Simple** - Just 3 options
+- **Lightweight** - Just 6KB of JS and CSS
+- **Fast** - Uses CSS flexbox for layout
+- **Responsive** - Show different number of columns at different breakpoints
+- **Simple** - Just 3 options
[See a demo](https://flexmasonry.now.sh/)
## Install
-* Download the [latest release](https://github.com/gilbitron/flexmasonry/releases).
-* Clone this repo.
-* Install using NPM/Yarn:
+- Download the [latest release](https://github.com/gilbitron/flexmasonry/releases).
+- Clone this repo.
+- Install using NPM/Yarn:
```
npm install flexmasonry
@@ -29,7 +29,10 @@ yarn add flexmasonry
Then, include the `flexmasonry.js` and `flexmasonry.css` files from the `dist` folder in your HTML. Or you can use the files directly from a CDN:
```html
-
+
```
@@ -39,18 +42,18 @@ Set up your HTML. For example:
```html
-
-
-
-
-
+
+
+
+
+
```
Then hook up the script, passing in the selector target:
```js
-FlexMasonry.init('.grid');
+FlexMasonry.init(".grid");
```
FlexMasonry will then convert all `.grid` elements to masonry grids with multiple columns.
@@ -82,15 +85,20 @@ The second, optional, parameter of the `init` method is an object containing opt
* no matter the width of the screen.
*/
numCols: 4,
+ /*
+ * If you want to give gap between of the columns/row
+ */
+ gap: 0,
}
```
For example, to always shown 6 columns in your grid:
```js
-FlexMasonry.init('.grid', {
- responsive: false,
- numCols: 6
+FlexMasonry.init(".grid", {
+ responsive: false,
+ numCols: 6,
+ gap: 2,
});
```
@@ -102,21 +110,21 @@ The `FlexMasonry` variable has several methods:
Initialises the FlexMasonry library and sets up the `targets` as masonry grids.
-* `targets` can be a string, an array of elements or a `NodeList`.
-* `options` [see above](#options).
+- `targets` can be a string, an array of elements or a `NodeList`.
+- `options` [see above](#options).
**`refresh(target, options = {})`**
Refreshes the `target` grid layout.
-* `target` must be an `Element`.
-* `options` [see above](#options).
+- `target` must be an `Element`.
+- `options` [see above](#options).
**`refreshAll(options = {})`**
Refreshes the grid layouts of all `targets` passed to `init()`.
-* `options` [see above](#options).
+- `options` [see above](#options).
**`destroyAll()`**
@@ -141,9 +149,9 @@ A good question! You _can_ use pure CSS to achieve the same outcome. However, th
To show your support for my work on this project:
-* [Star this repository](https://github.com/gilbitron/flexmasonry/stargazers)
-* [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Fflexmasonry)
-* [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship)
+- [Star this repository](https://github.com/gilbitron/flexmasonry/stargazers)
+- [Tell others about this project](https://twitter.com/intent/tweet?url=https%3A%2F%2Fgithub.com%2Fgilbitron%2Fflexmasonry)
+- [Sponsor me on GitHub](https://github.com/users/gilbitron/sponsorship)
## Credits
diff --git a/demo/index.html b/demo/index.html
index d4f87d6..bc1d2c0 100644
--- a/demo/index.html
+++ b/demo/index.html
@@ -1,72 +1,194 @@
-
-
-
+
+
+
FlexMasonry
-
-
-
+
+
+