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

@femate/img-preview

v0.1.3

Published

一个简洁而又高效的Ts+Rollup的打包模板

Downloads

12

Readme

简介

使用文档介绍 | 博文介绍 | 在线预览

特性

  • ✅触摸手势:拖动/平移/物理效果滑动,双指指定位置放大/缩小
  • ✅鼠标滚动缩放:丝滑般的缩放效果
  • ✅多端适配:完美适配桌面端和移动端
  • ✅简单、易可拓展的API,零成本上手
  • ✅基于typescript、``、支持服务端渲染
  • ✅支持自定义节点扩展,轻松实现全屏预览、旋转控制、图片介绍以及更多功能
  • ✅超详细文档:适合在校大学生、实习生、中高级前端开发学习和使用

如果您觉得这个项目还不错, 可以在 Github 上面帮我点个star, 支持一下作者 ☜(゚ヮ゚☜)

如何使用

方式1:通过 script 标签引入

CDN源

CDN源:jsdelivr


<script src="https://cdn.jsdelivr.net/npm/@femate/img-preview@latest/dist/index.umd.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@femate/img-preview@latest/dist/index.css" />

CDN源:unpkg

<script src="https://unpkg.com/@femate/img-preview@latest/dist/index.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/@femate/img-preview@latest/dist/index.css" />

HTML调用

<div id="app">
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
</div>
<script type="text/javascript">
    window.onload = () => {
        const ImgPre = new ImgPreview('#app', {
            imageZoom: {
                step: 1
            },
            style: {
                maskOpacity: 0.8
            },
            onHide() {
                //...
            }
        })
    }
</script>

方式2:通过 import 引入

安装依赖

npm i @femate/img-preview
# or
pnpm add @femate/img-preview
# or
yarn add  @femate/img-preview 

使用

<div id="app">
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
  <img src="https://picsum.photos/800/800" alt="" />
</div>
  import ImgPreview from '@femate/grid-picture'
  const ImgPre = new ImgPreview('#app', {
            imageZoom: {
                step: 1
            },
            style: {
                maskOpacity: 0.8
            },
            onHide() {
                //...
            }
        })

事件

更新列表

动态更新图片列表场景

// 图片渲染到页面后调用
ImgPre.update()

幻灯片模式

简单实现幻灯片模式

  let timer = null
  const ImgPre = new ImgPreview('#app',{
    clearInterval(timer)
  })
  function play() {
      timer && clearInterval(timer)
      let index = 0
      ImgPre.show(index)
      timer = setInterval(() => {
          if (index < a.getTotalIndex()) {
              index++
          } else {
              index = 0
          }
          ImgPre.show(index)
      }, 2000)
  }

上下翻页

ImgPre.next()
ImgPre.prev()

About Me

公众号:盲僧公众号,关注后回复「粉丝群」

RoadMap

Milestones

License

Apache-2.0 © MaleWeb