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-lightbox-lite

v1.2.3

Published

A lightweight image and video lightbox gallery component for Vue

Downloads

205

Readme

vue-lightbox-lite

A lightweight image, video and iframe lightbox gallery component for Vue. Supports slide, zoom, rotation, autoplay, captions and so on, based on Vue-cool-lightbox.

轻量级的图片/视频 预览器,支持自动播放、旋转、缩放、全屏、键盘及手势滑动切换等。

default screenshot

light screenshot

Features

  1. No external dependencies.
  2. Fully responsive.
  3. autoplay slides that play or pause
  4. Full screen support.
  5. Multiple zoom levels.
  6. Rotate images.
  7. YouTube Vimeo and html5 videos Support.
  8. Keyboard Navigation for desktop.
  9. And many more.

Installation

npm install vue-lightbox-lite

# 或

yarn add vue-lightbox-lite

Usage

1. Global import

In main.js:

// main.js
import Lightbox from 'vue-lightbox-lite'
import 'vue-lightbox-lite/dist/index.css'

Vue.use(Lightbox)

In component.vue

<template>
<div class="lightbox">
  <ul class="list">
    <li v-for="(item, key) in list" :key="key" @click="index = key">link - {{ key }}</li>
  </ul>

  <LightBox
    :index="index"
    :items="list"
  />
</div>
</template>

<script>
export default {
  data() {
    return {
      index: null,
      list: [
        'http://www.domain.com/image.jpg',
        'http://www.domain.com/video.mp4',
        {
          src: 'http://www.domain.com/playgame/',
          mediaType: 'video',
          ext: 'webm',
          title: '',
          description: ''
        },
        'https://www.youtube.com/watch?v=d0tU18Ybcvk',
        {
          src: 'https://www.youtube.com/watch?v=d0tU18Ybcvk',
          mediaType: 'webVideo'
        },
        {
          src: 'http://www.domain.com/file.pdf',
          mediaType: 'iframe'
        }
      ]
    }
  }
}
</script>

2. In Component

<template>
<div class="lightbox">
  <button @click="index = 0">preview</button>

  <Viewer
    :index="index"
    :items="list"
  />
</div>
</template>

<script>
import VueLightbox from 'vue-lightbox-lite'
import 'vue-lightbox-lite/dist/index.css'

export default {
  component: {
    Viewer: VueLightbox
  },
  data() {
    return {
      index: null,
      list: [
        'http://www.domain.com/image.jpg',
        'http://www.domain.com/video.mp4',
        'http://www.domain.com/file.pdf'
      ]
    }
  }
}
</script>

API

Items attributes

| Name | Type | Default | Description | | ----------- | -------------- | ------- | --------------------------------------------------- | | src | String | | Url of the image/video/iframe | | mediaType | String | image | media type, image, video, webVideo, iframe | | ext | String | | e.g. mp4, ogg, webm, pdf | | thumb | String | | | | alt | String | | | | srcset | String | | | | sizes | String | | | | title | String | | | | description | String | | | | width | String|Number | auto | Control width, video & iframe | | height | String|Number | auto | | | maxWidth | String|Number | auto | | | maxHeight | String|Number | auto | |

props

| Name | Type | Default | Description | | ---------------- | ----------------------- | -------------------------------- | ------------------------------------------------------------ | | index | Number | null | Index of items to open | | items | Array<Object | String> | | Array of images/videos | | container | Element | String | document.body | | | theme | String | dark | darklight | | customClass | String | | | | zIndex | Number | 9999 | | | highColor | String | #fa4242 | progressbar color and thumbnails border-color | | overlayColor | String | | | | navigator | Boolean | true | | | toolbar | Array | | toolbar: counter, zoom, slide, rotate, gallery, fullscreen, download, close | | loop | Boolean | true | | | slideDuration | Number | 3500 | | | showGallery | Boolean | false | | | galleryPosition | String | | rightbottom | | video | Object | {autoplay: false, raito: 16/9} | video parameter,autoplay, width,height,maxWidth,maxHeight | | iframe | Object | | width,height,maxWidth,maxHeight | | enableWheelEvent | Boolean | false | | | enableScrollLock | Boolean | true | | | clickOutsideHide | Boolean | true | |

Slots

  • loading
  • icon-previous
  • icon-next

Events

  • open(index: number)
  • close
  • change(index: number)
  • change-end(index: number)

Methods

  • open(index)
  • close()
  • previous()
  • next()
  • change(index)