vue-enlargeable-image
A Vue component that, when clicked, will enlarge an image from thumbnail to full version using a smooth animation.
Features
- Specify both a thumbnail source and a full size source
- Thumbnail version will load immediately
- Full version will load upon enlargement and is transformed seamlessly from the thumbnail version
- Specify the duration of the animation
- Nest any component or HTML element within - doesn't have to be just an img element (keep reading to learn more)
- Style the component however you want with your own CSS class definitions (keep reading to learn more)
Requirements
Installation
npm
external script
Usage
main.js:
template:
nesting an HTML element instead of the default img:
nesting another component instead of the default img (and setting the animation duration):
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
src | String | N/A | yes | Relative path or absolute URL to the thumbnail image |
src_large | String | N/A | yes | Relative path or absolute URL to the full size image |
animation_duration | String | 700 | no | How many milliseconds that the enlarging and delarging animation will take (0 for no animation) |
Events
Name | Arguments | Description |
---|---|---|
enlarging | None | Fired when image starts to get bigger |
enlarged | None | Fired when image has reached full size |
delarging | None | Fired when image starts to get smaller |
delarged | None | Fired when image is back to original size |