Skip to content

Commit

Permalink
Add react example
Browse files Browse the repository at this point in the history
  • Loading branch information
kingdido999 committed Nov 4, 2017
1 parent 1200d54 commit 4ab051a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 0 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ At this point, any image with attribute `data-action="zoom"` is zoomable by defa
<img src="img/journey.jpg" data-action="zoom" />
```

If you click while holding your meta key (`` or `Ctrl`), it opens the image in a new tab.

## Examples

The source code of [demo](http://desmonding.me/zooming/) page is a simple demonstration on how to integrate Zooming and personalize it on your web page. Take a look at [index.html](https://github.com/kingdido999/zooming/blob/master/index.html) and [demo/js/custom.js](https://github.com/kingdido999/zooming/blob/master/demo/js/custom.js).
Expand Down
12 changes: 11 additions & 1 deletion docs/advanced-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,14 @@ const zoomingDark = new Zooming({
zoomingLight.config({
// ...
})
```
```

## Open the image in a new tab

Click while holding your meta key (`` or `Ctrl`).

## Working with React

Please see this [example](https://github.com/kingdido999/atogatari/blob/master/client/src/components/ZoomableImage.js).

Notice that it's best to pass in an initialized `zooming` instance as a prop to your component and use that instance to listen to your images within `componentDidMount` method. In this way, we don't create new `zooming` instances everytime the component rerendered.

0 comments on commit 4ab051a

Please sign in to comment.