All Projects → laurenashpole → vue-inner-image-zoom

laurenashpole / vue-inner-image-zoom

Licence: other
laurenashpole.github.io/vue-inner-image-zoom

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to vue-inner-image-zoom

Photo view
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.
Stars: ✭ 1,280 (+1322.22%)
Mutual labels:  images, zoom
Pinchimageview
体验非常好的Android图片手势控件。
Stars: ✭ 1,871 (+1978.89%)
Mutual labels:  zoom-images, zoom
ZoomLayout
想要缩放、平移的 View,放在 ZoomLayout 中就可以实现了
Stars: ✭ 34 (-62.22%)
Mutual labels:  zoom-images, zoom
React Inner Image Zoom
A React component for zooming images.
Stars: ✭ 76 (-15.56%)
Mutual labels:  images, zoom
Tileview
TileView is a subclass of android.view.ViewGroup that asynchronously displays, pans and zooms tile-based images. Plugins are available for features like markers, hotspots, and path drawing.
Stars: ✭ 1,447 (+1507.78%)
Mutual labels:  images, zoom
magnify-3d
Real time Javascript optic magnifying glass library.
Stars: ✭ 37 (-58.89%)
Mutual labels:  zoom, magnify
react-simple-image-zoom
Simple image zoom component for react
Stars: ✭ 12 (-86.67%)
Mutual labels:  zoom-images, magnify
zoom-slack-status-updater
Update your Slack status automatically when you join a Zoom meeting.
Stars: ✭ 23 (-74.44%)
Mutual labels:  zoom
fl-image-resize
A library to quickly resize images with Azure Functions
Stars: ✭ 15 (-83.33%)
Mutual labels:  images
imgix-java
A Java client library for generating URLs with imgix
Stars: ✭ 17 (-81.11%)
Mutual labels:  images
Lassi-Android
All in 1 picker library for android.
Stars: ✭ 108 (+20%)
Mutual labels:  images
droste-creator
Create recursive images with the droste effect.
Stars: ✭ 27 (-70%)
Mutual labels:  images
coronavirus-mask-image-dataset
Image dataset from Instagram of people wearing medical masks, no mask, or a non-medical (DIY) mask
Stars: ✭ 57 (-36.67%)
Mutual labels:  images
jam
🍓 Jam is your own open source Clubhouse for mini conferences, friends, communities
Stars: ✭ 1,030 (+1044.44%)
Mutual labels:  zoom
Neural-Zoom
Infinite Zoom For Style Transfer
Stars: ✭ 34 (-62.22%)
Mutual labels:  zoom
KGySoft.Drawing
KGy SOFT Drawing is a library for advanced image, icon and graphics handling.
Stars: ✭ 27 (-70%)
Mutual labels:  images
hakyll-images
Hakyll utilities to work with images
Stars: ✭ 13 (-85.56%)
Mutual labels:  images
android-pickpic
Ready to use library that allows people to select pictures from their device and Facebook account.
Stars: ✭ 12 (-86.67%)
Mutual labels:  images
high-quality-nix-content
GitHub repository containing highest quality Nix/NixOS content
Stars: ✭ 88 (-2.22%)
Mutual labels:  images
octodex
GitHub's Octocats.
Stars: ✭ 64 (-28.89%)
Mutual labels:  images

vue-inner-image-zoom

Demos

A Vue component for magnifying an image within its original container. The zoom behavior is triggered on click and the image can be moved by dragging on touch devices and by either dragging or hover panning on non-touch devices. The component supports responsive images and optional fullscreen zoom on mobile.

This component is based on an earlier version built for React.

GitHub Actions npm package

Installation

Note: Version 2.0.0 upgrades the component to support Vue 3. To use this package with older versions of Vue, install using npm install [email protected] or yarn add [email protected] instead of the instructions below.

NPM

npm install vue-inner-image-zoom

Yarn

yarn add vue-inner-image-zoom

Styling

Import the CSS from your node_modules directory using:

import 'vue-inner-image-zoom/lib/vue-inner-image-zoom.css';

Usage

Import the component and include in your template:

import InnerImageZoom from 'vue-inner-image-zoom';

...

export default {
  components: {
    'inner-image-zoom': InnerImageZoom
  }
}

...

<inner-image-zoom src="/path/to/image.jpg" zoomSrc="/path/to/zoom-image.jpg" />

This is the simplest usage. For additional examples, visit the demo page.

Props

Prop Type Default Description
src String (Required) URL for the original image.
srcSet String Default srcset attribute for a responsive original image.
sizes String Default sizes attribute for use with srcset.
sources Array A list of image sources for using the picture tag to serve the appropriate original image (see below for more details).
width Number Width attribute for original image.
height Number Height attribute for original image.
hasSpacer Boolean false If true, gets the original image's aspect ratio based on the width and height props and creates a spacer to prevent cumulative layout shift.
zoomSrc String URL for the larger zoom image. Falls back to original image src if not defined.
zoomScale Number 1 Multiplied against the natural width and height of the zoomed image. This will generally be a decimal (example, 0.9 for 90%).
zoomPreload Boolean false If set to true, preloads the zoom image instead of waiting for mouseenter and (unless on a touch device) persists the image on mouseleave.
alt String Alternative text for the original image.
moveType String pan pan or drag. The user behavior for moving zoomed images on non-touch devices.
zoomType String click click or hover. The user behavior for triggering zoom. When using hover, combine with zoomPreload to avoid flickering on rapid mouse movements.
fadeDuration Number 150 Fade transition time in milliseconds. If zooming in on transparent images, set this to 0 for best results.
fullscreenOnMobile Boolean false Enables fullscreen zoomed image on touch devices below a specified breakpoint.
mobileBreakpoint Number 640 The maximum breakpoint for fullscreen zoom image when fullscreenOnMobile is true.
hideCloseButton Boolean false Hides the close button on touch devices. If set to true, zoom out is triggered by tap.
hideHint Boolean false Hides the magnifying glass hint.
className String Custom classname for styling the component.
afterZoomIn Function Function to be called after zoom in.
afterZoomOut Function Function to be called after zoom out.

Sources

This prop accepts an array of objects which it uses to create a picture tag and source elements. The component looks for the following optional properties and you can find additional details on responsive images here:

Prop Type Default Description
srcSet String Srcset attribute for source tag.
sizes String Sizes attribute for source tag.
media String An attribute containing a media condition for use with the srcset.
type String An image MIME type. This is useful for using newer formats like WebP.

Issues

Please submit issues or requests here.

Most of the implementation choices for this component are based on use cases I've encountered in the past. For example, I chose a click to zoom trigger because it was requested on previous product detail pages I've worked on. If there's a demand for zoom on hover or other additional functionality, I'd be open to taking a look.

One of my big motivations for adapting this component from the original React Inner Image Zoom was to give Vue a try so don't hesitate to flag any areas in the code or the documentation where I'm not following Vue's best practices.

License

MIT

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].