Skip to content

Commit eb8bb34

Browse files
author
ben
committed
updated docs
1 parent b813e53 commit eb8bb34

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ Property | Type | Default | Description
7575
:-----------------------|:--------------|:--------------|:--------------------------------
7676
images | array | undefined | Required. An array of objects containing image properties (see Image Options above).
7777
enableImageSelection | bool | true | Optional. Allow images to be selectable. Setting this option to `false` whilst supplying images with `isSelected: true` will result in those images being permanently selected.
78-
onSelectImage | func | undefined | Optional. Function to execute when an image is selected. Access to image object using `this` (See [Programmers note](#Programmers-Note) for info about Function.prototype.call()). Optional args: index (index of selected image in images array), image (the selected image). This function is only executable when `enableImageSelection: true`.
78+
onSelectImage | func | undefined | Optional. Function to execute when an image is selected. Access to image object using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()). Optional args: index (index of selected image in images array), image (the selected image). This function is only executable when `enableImageSelection: true`.
7979
rowHeight | number | 180 | Optional. The height of each row in the gallery.
8080
maxRows | number | undefined | Optional. The maximum number of rows to show in the gallery.
8181
margin | number | 2 | Optional. The margin around each image in the gallery.
8282
enableLightbox | bool | true | Optional. Enable lightbox display of full size image when thumbnail clicked.
83-
onClickThumbnail | func | openLightbox | Optional. Function to execute when gallery thumbnail clicked. Allows access to thumbnail using `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). Optional args: index (index of selected image in images array), event (the click event). Overrides openLightbox.
84-
lightboxWillOpen | func | undefined | Optional. Function to be called before opening lightbox. Allows access to gallery using `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). Optional arg: index (index of selected image in images array).
85-
lightboxWillClose | func | undefined | Optional. Function to be called before closing lightbox. Allows access to gallery using `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call).
83+
onClickThumbnail | func | openLightbox | Optional. Function to execute when gallery thumbnail clicked. Allows access to thumbnail using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()). Optional args: index (index of selected image in images array), event (the click event). Overrides openLightbox.
84+
lightboxWillOpen | func | undefined | Optional. Function to be called before opening lightbox. Allows access to gallery using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()). Optional arg: index (index of selected image in images array).
85+
lightboxWillClose | func | undefined | Optional. Function to be called before closing lightbox. Allows access to gallery using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()).
8686
tagStyle | object | tagStyle | Optional. Style to pass to tag elements. Overrides internal tag style.
87-
tileViewportStyle | func | tileViewportStyle | Optional. Function to style the image tile viewport. Allows access to image tile viewport using `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). Overrides internal tileViewportStyle function.
88-
thumbnailStyle | func | thumbnailStyle | Optional. Function to style the image thumbnail. Allows access to thumbnail using `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call). Overrides internal thumbnailStyle function.
87+
tileViewportStyle | func | tileViewportStyle | Optional. Function to style the image tile viewport. Allows access to image tile viewport using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()). Overrides internal tileViewportStyle function.
88+
thumbnailStyle | func | thumbnailStyle | Optional. Function to style the image thumbnail. Allows access to thumbnail using `this` (See [Programmers notes](#Programmers-notes) for info about Function.prototype.call()). Overrides internal thumbnailStyle function.
8989

9090
## Lightbox Options
9191
NOTE: these options are passed inside the Gallery tag.
@@ -124,28 +124,28 @@ lightboxWidth | number | 1024 | Optional. Maximum width of th
124124

125125
* Image Options: `thumbnail` can point to the same resource as `src`, bearing in mind the resultant data size of the gallery and page load cost. Thumbnails of whatever size will be scaled to match `rowHeight`.
126126

127-
* If you don't know your `thumbnailWidth` and `thumbnailHeight` values, you can find these out using any number of [javascript hacks](http://stackoverflow.com/a/1944298), bearing in mind the load penalty associated with these methods.
128-
129127

130-
### Programmers Note
128+
### Programmers Notes
131129

132130
* User defined functions that allow access to `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) do not require you to pass `this` as a parameter. `this` will be defined at the time the function is called.
133131

134132
e.g.
135133
```js
136-
//somewhere in your code...
134+
// somewhere in your code...
137135
function myTileViewportStyleFn() {
138136
if (this.props.item.isSelected)
139137
return {
140-
//some awesome style
138+
// something stylish...
141139
};
142140
}
143141

144-
//internally, within the react-grid-gallery component it will be called like so:
145-
myTileViewportStyleFn.call(this);
142+
// internally, within the react-grid-gallery component it will be called like so:
143+
myTileViewportStyleFn.call(this); // this now refers to the image to be styled
146144

147145
```
148146

147+
* If you don't know your `thumbnailWidth` and `thumbnailHeight` values, you can find these out using any number of [javascript hacks](http://stackoverflow.com/a/1944298), bearing in mind the load penalty associated with these methods.
148+
149149

150150
### License
151151
React Grid Gallery is free to use for personal and commercial projects under the [MIT License](https://github.com/benhowell/react-grid-gallery/blob/master/LICENSE). Attribution is not required, but appreciated.

0 commit comments

Comments
 (0)