All Projects → aaronlifton → react-simple-image-zoom

aaronlifton / react-simple-image-zoom

Licence: MIT License
Simple image zoom component for react

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to react-simple-image-zoom

Pinchimageview
体验非常好的Android图片手势控件。
Stars: ✭ 1,871 (+15491.67%)
Mutual labels:  zoom-images, zoomable-images
vue-inner-image-zoom
laurenashpole.github.io/vue-inner-image-zoom
Stars: ✭ 90 (+650%)
Mutual labels:  zoom-images, magnify
SPPhotoViewer
A customisable smart photoviewer of your photos!!!
Stars: ✭ 14 (+16.67%)
Mutual labels:  zoom-images
image-zoom
smooth, iOS/medium.com style thumbnail viewing
Stars: ✭ 35 (+191.67%)
Mutual labels:  image-zoom
ZoomLayout
想要缩放、平移的 View,放在 ZoomLayout 中就可以实现了
Stars: ✭ 34 (+183.33%)
Mutual labels:  zoom-images
annotorious-openseadragon
An OpenSeadragon plugin for annotating high-res zoomable images
Stars: ✭ 93 (+675%)
Mutual labels:  zoomable-images
magnify-3d
Real time Javascript optic magnifying glass library.
Stars: ✭ 37 (+208.33%)
Mutual labels:  magnify
Subsampling Scale Image View
Copyright 2018 David Morrissey, and licensed under the Apache License, Version 2.0. No attribution is necessary but it's very much appreciated. Star this project if you like it!
Stars: ✭ 7,137 (+59375%)
Mutual labels:  zoom-images
Medium Zoom
🔎🖼 A JavaScript library for zooming images like Medium
Stars: ✭ 2,799 (+23225%)
Mutual labels:  image-zoom
Zooming
🔍 Image zoom that makes sense.
Stars: ✭ 1,538 (+12716.67%)
Mutual labels:  image-zoom
fast-image-zoom
🏞 Fast image zoom on click as seen on popular publishing platform
Stars: ✭ 21 (+75%)
Mutual labels:  image-zoom
rais-image-server
RAIS: A IIIF-compliant, 100% open source image server for blazing-fast deep zooming
Stars: ✭ 72 (+500%)
Mutual labels:  zoomable-images

React simple image zoom

A simple image zoom component

Demo

Example

npm version

Install

mgr cmd
npm npm install --save react-simple-image-zoom
yarn yarn add react-simple-image-zoom

Usage

import { ImageZoom } from 'react-simple-image-zoom';
const largeCatImg = 'https://www.nationalgeographic.com/content/dam/animals/thumbs/rights-exempt/mammals/d/domestic-cat_thumb.ngsversion.1472140774957.adapt.1900.1.jpg';

const App = () =>
  <div id="app">
    <div style={{width: "540px", marginLeft: "20px", overflow: "hidden"}}>
      <ImageZoom
        portalId="portal"
        largeImgSrc={largeCatImg}
        imageWidth={540}
        imageHeight={540}
        zoomContainerWidth={540}
        activeClass="my-active"
        portalStyle={Object.assign(
          {...ImageZoom.defaultPortalStyle},
          {top: "140px"}
        )}
        zoomScale={1}
        responsive={true}
      >
        <img src={largeCatImg} alt="Cat image" width="100%"/>
      </ImageZoom>
    </div>

    <div id="portal" />
  </div>

ReactDOM.render(<App />, document.getElementById('myAppContainer'));

See ./demo for a more detailed example.

Props

prop required type description
children     yes any pass the source image in as a child element
portalId yes string ID of the target portal element
largeImgSrc no string optional high-res source to use for the zoom container
imageWidth yes number width of the original image on the screen
imageHeight no number optional, pass in an image height to use for calculations. otherwise this component will figure it out.
zoomContainerWidth yes number width of the portal zoom
zoomContainerHeight no number height of the portal zoom
activeClass no string optional, default is 'active'. applies this class to the image container when zooming is active
portalStyle no React.CSSProperties optional, override the style of the portal. To extend the default style, use ImageZoom.defaultPortalStyle
portalClassName no string optional, sets className on the portal element
zoomScale no number optional, default is 1. Determines the amount of zoom.
responsive no boolean optional, default is null. Component will listen for window resize and adjust accordingly

Usage with react-slick

  • For the magnifying glass to work, make sure you style .slick-side like this:
    .slick-side {
      position: relative;
    }

Development

  • yarn run dev
  • check http://localhost:8080/docs

Todo

  • get component to work on mobile devices

License

Copyright © 2018 Aaron Lifton

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].