1.1.10 • Published 5 years ago

react-zoomable-image-updated v1.1.10

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

React Zoomable Image

Zoomable image for mouse and touch devices. Built with React.

Demo

Installation

npm install --save react-zoomable-image

Example

import React, { Component } from 'react';
import ZoomableImage from 'react-zoomable-image';

class Zoom extends Component {
  render() {
    return (
      <ZoomableImage
        baseImage={{
          alt: 'An image',
          src: 'http://via.placeholder.com/350x550',
          width: 350,
          height: 550
        }}
        largeImage={{
          alt: 'A large image',
          src: 'http://via.placeholder.com/450x707',
          width: 450,
          height: 707
        }}
        thumbnailImage={{
          alt: 'A small image',
          src: 'http://via.placeholder.com/70x110'
        }}
      />
    );
  }
}

Props

imageType: {
  alt: string,
  src: string,
  width: number,
  height: number
}

thumbnailType: {
  alt: string,
  src: string
}
PropertyTypeDescription
baseImageimageTypeThe initial image with no zoom applied. Rendered as an image element, with supplied width and height
largeImageimageTypeThe zoomed image. Width and height, relative to baseImage's width and height, determine initial zoom level
thumbnailImagethumbnailTypeSmall "map" image displayed in top left corner during zoom. Size determined by mapScaleFactor
displayMapboolShould a thumbnail map image be shown? Defaults to true
mapBorderColorstringColor of border around the thumbnail map image
mapScaleFactornumberSize of thumbnail map, relative to baseImage. Defaults to 0.2
zoomTransitionTimenumberDuration of zoom-in and zoom-out transitions. Defaults to 300

Tests

Tested with Jest. To run tests, clone the project, install dependencies, and npm run test

1.1.10

5 years ago

1.1.9

5 years ago

1.1.8

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago