项目
在 GitHub 查看
malaman/react-image-zoom
关于
React component for desktop browsers for image zoom on mouse hover
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文react-image-zoom
Overview
React component for desktop browsers for image zoom on mouse hover.
Demo
Install
npm install react-image-zoom --save
Usage
import React from 'react';
import ReactDOM from 'react-dom';
import ReactImageZoom from 'react-image-zoom';
const props = {width: 400, height: 250, zoomWidth: 500, img: "1.jpg"};
ReactDOM.render(<ReactImageZoom {...props} />, document.getElementById('react-app'));
propTypes
- width (number) - width of the source image (required)
- height (number) - height of the source image. If not provided, browser calculated height is used (optional).
- zoomWidth (number) - width of the zoomed image. Zoomed image height equals source image height(optional if scale param is provided)
- img (string) - url of the source image. Provided if container does not contain img element as a tag(optional)
- scale (number) - zoom scale. if not provided, scale is calculated as natural image size / image size, provided in params (optional if zoomWidth param is provided)
- offset (object) - {vertical: number, horizontal: number}. Zoomed image offset (optional)
- zoomStyle (string) - custom style applied to the zoomed image (i.e. 'opacity: 0.1;background-color: white;')(optional)
- zoomLensStyle (string) custom style applied to to zoom lents (i.e. 'opacity: 0.4;background-color: gray;')
- zoomPosition (string) - position of zoomed image. It can be:
top,left,bottom,originalor the defaultright.
RouteMap
- add sourceImg, zoomedImg properties to make it possible to use different images for source and zoomed images
探索相关项目
加载中…