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

preview-image-js

v1.1.2

Published

Picture preview pop-up window

Downloads

258

Readme

preview image

图片预览插件,支持缩放、拖拽、旋转、实际尺寸、适应窗口、缩略图预览等功能

import previewImage from 'preview-image-js'
previewImage({
    index: 1, // 默认显示图片索引,默认为0
    images: ['https://xxx.jpg', "https://xxx.jpg"], // 图片地址数组,默认为空
    thumbnail: true, // 是否显示缩略图预览,默认为true
    thumbnailDraggable: true, // 是否允许拖拽缩略图,默认为true
    onDelete: function (index, url) { // 删除回调,默认为空函数,若不允许删除或者删除失败,返回Promise.reject即可(throw Error也可以)
        console.log('删除', index)
        // return Promise.reject('无权限')
    },
    delete: true, // 是否显示删除按钮,默认为false
    download: true, // 是否显示下载按钮,默认为false
    onDownload: function (index, url) { // 下载回调,不传的话会用内置的下载方法来下载图片到本地
        console.log('下载', index)
    },
    // thumbnailTitleText: 'overview', // 缩略图标题,默认为’缩略图‘
    // maxZoomText: 'It\'s already the maximum size', // 放大到最大时提示,默认为’已放到最大‘
    // minZoomText: 'It\'s already the smallest', // 缩小到最小时提示,默认为’已缩到最小‘
    // fitText: 'fit to screen', // 适应屏幕提示,默认为’适应屏幕‘
    // actualSizeText: 'actual size', // 实际尺寸提示,默认为’实际尺寸‘
    // zoomInText: 'zoom in', // 放大提示,默认为’放大‘
    // zoomOutText: 'zoom out', // 缩小提示,默认为’缩小‘
    // rotateLeftText: 'rotate left', // 逆时针旋转提示,默认为’左转‘
    // rotateRightText: 'rotate right', // 顺时针旋转提示,默认为’右转‘
    // downloadText: 'download', // 下载提示,默认为’下载‘
    // deleteText: 'delete', // 删除提示,默认为’删除‘
    // nextText: 'next', // 下一张提示,默认为’下一张‘
    // prevText: 'prev' // 上一张提示,默认为’上一张‘
})