npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-directive-image-previewer

v2.2.2

Published

A Vue.js directive plugin for <img>, click image to show preview.

Downloads

1,376

Readme

vue-directive-image-previewer

A Vue.js project for tag img, click img to zoom out to full screen.

Build Setup

# install vue-directive-image-previewer
npm install vue-directive-image-previewer -D

# main.js
import VueDirectiveImagePreviewer from 'vue-directive-image-previewer'
import 'vue-directive-image-previewer/dist/assets/style.css'
Vue.use(VueDirectiveImagePreviewer)	
or
Vue.use(VueDirectiveImagePreviewer, {
  background: {     // or : background: '#000'
    color: '#000' // or rgba or rgb     // or image: 'url(xxx)'
  },
  // transition
  animate: {
    duration: 600,
    delay: 500
  },
  // loading (not supported)
  loading: {
    image: ''
  },
  // cursor(css)
  cursor: 'pointer',
  clickMethod: 'doubleClick'   // click or doubleClick(not supported)
})

# use this directive
<img v-image-preview src="some-pic-url"/>
or 
<img v-image-preview="some-pic-url or another-pic-url" src="some-pic-url"/>
or
<img v-image-preview="{src: 'some-pic-url or another-pic-url'}" src="some-pic-url"/>

Github

github Why not Star? Why? Come on!

Welcome to give me some advise or help me to make the code stronger, thanks!

Demo

http://demo.image-previewer.anymelon.com

Api (updated at 2018-08-14)

options(in Vue.use())(Global Settings)

| API | TYPE | EXAMPLE | DEFAULT | DESCRIBE | | ---------------------------- | ------------- | ---------------------------------------- | ----------------- | ---------------------------------------- | | background | String / JSON | "#000000" or "rgba(0, 0, 0, 0.5)" or {backgroundColor: "#000000"} | {backgroundColor:"#000000"} | Background css of wrapper | | animate | JSON | {duration: 500, delay: 300, func: "linear"} | {duration: 500} | Transition css of image(field "duration" must be Number) | | loading(not support yet) | JSON | {pictureUrl: "http://somePicUrl"} | undefined | Settings of image when it is loading | | cursor | String | (whatever of css cursor) | "pointer" | Cursor css of image which has directive "v-image-preview" | | clickMethod(not support yet)| String | "click" / "doubleClick" | "click" | Method of opening image, not for closing | | copy | Boolean | true / false | true | if copy === true, when previewer is showing, the original picture will not disappear, on the contrary, it will disappear(by setting visibility: hidden;)| | zIndex | Number | 1000 | 1 | css 'z-index' of outermost wrapper | | maxWidth | Number || String | 1000 or '1000px' or '100%' | undefined | max width of previewer | | maxHeight | Number || String | 1000 or '1000px' or '100%' | undefined | max height of previewer | | previewSize | Number || String | 2 (previewer.width = image.width * 2, previewer.height = image.height * 2) or '20%' | undefined | how many times of the previewer with image |

options(in directive)(Setting only for Element itself)

| API | TYPE | EXAMPLE | DEFAULT | DESCRIBE | | ---------- | ------ | --------------------- | ------------ | ---------------------------------------- | | ALL | String | "http://some-pic-url" | src of | This is for only set in a String, like v-image-preview="some-pic-url". | | background | String / JSON | "#000000" or {backgroundColor: "#000000"} | {backgroundColor:"#000000"} | Background css of wrapper | | src | String | "http://some-pic-url" | src of | When you want to set another optioins of directive, use this. | | cursor | String | (whatever of css cursor) | "pointer" | Cursor css of image which has directive "v-image-preview" | | animate | JSON | {duration: 500, delay: 300, func: "linear"} | {duration: 500} | Transition css of image(field "duration" must be Number) | | copy | Boolean | true / false | true | if copy === true, when previewer is showing, the original picture will not disappear, on the contrary, it will disappear(by setting visibility: hidden;)| | zIndex | Number | 1000 | 1 | css 'z-index' of outermost wrapper | | maxWidth | Number || String | 1000 or '1000px' or '100%' | undefined | max width of previewer | | maxHeight | Number || String | 1000 or '1000px' or '100%' | undefined | max height of previewer | | previewSize | Number || String | 2 (previewer.width = image.width * 2, previewer.height = image.height * 2) or '20%' | undefined | how many times of the previewer with image |

ChangeLog

2018-8-14

Add APIs: maxWidth, maxHeight, previewSize