https://github.com/intera/vue-zoom-on-hover
responsive image with zoomed image on hover
https://github.com/intera/vue-zoom-on-hover
vue
Last synced: about 1 year ago
JSON representation
responsive image with zoomed image on hover
- Host: GitHub
- URL: https://github.com/intera/vue-zoom-on-hover
- Owner: Intera
- License: gpl-3.0
- Created: 2018-01-25T08:56:50.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-01-14T01:30:36.000Z (over 4 years ago)
- Last Synced: 2024-04-25T06:21:37.909Z (about 2 years ago)
- Topics: vue
- Language: JavaScript
- Size: 337 KB
- Stars: 165
- Watchers: 7
- Forks: 53
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
# vue-zoom-on-hover
responsive image with zoomed image on hover.

[demo](https://intera.github.io/vue-zoom-on-hover/demo/main.html) (ctrl+click to open in new tab)
this [vue.js](https://vuejs.org/) component displays an image with the width of the parent element and on hover shows the full image or a scaled image in the image area
# installation
include `zoomOnHover.js`, which registers the vue component and defines zoomOnHover, the variable for the component configuration object.
also include `zoomOnHover.css`, which contains the needed styles
# usage
minimal example (with an example div as parent container)
```html
```
all options
```html
```
register the component with your vue app or component
```javascript
new Vue({
el: "#app",
components: {
zoomOnHover: zoomOnHover
}
})
```
you can also check out demo/main.html for an example
# features
* enabled/disabled property
* custom scale for zoomed image
* optionally a separate zoom image
* event when all images loaded
* event when images resized (responsive css, etc)
* basic touch support with zoom/unzoom on tap
# caveats
if the parent container is bigger than the source image, the normal image stretches to the size of the parent container but the zoom image will have the original width (will be smaller for example)
# possible enhancements
* support for touch devices