1.0.0 • Published 9 years ago

react-image-magnifier v1.0.0

Weekly downloads
5
License
MIT
Repository
github
Last release
9 years ago

react-image-magnifier

A react component that accepts a high-res source image and produces a magnifier window on mouse hover over the part of the image the cursor is over

Demo

npm.io

Usage

> npm install --save react-image-magnifier
var ImageMagnifer = require('react-image-magnifier');

var App = React.createClass({

    render () {
        return (
            <ImageMagnifier
                image={{
                    src: "img/beach-small.jpg",
                    width: 400,
                    height: 300
                }}
                zoomImage={{
                    src: "img/beach-large.jpg",
                    width: 1600,
                    height: 1200
                }}
                cursorOffset={{ x: 80, y: -80 }}
            />
        );
    }
});

API (props)

PropRequiredDefaultTypeDescription
imageYES{ src, width, height }the src, size of the non-zoomed-in image
zoomImageYES{ src, width, height }the src, size of the zoomed-in image
cursorOffsetNO{ x: 0, y: 0 }{ x, y }the offset of the zoom bubble from the cursor
sizeNO200Numberthe size of the magnifier window