@likecoin/vue-image-lightbox

A Vue.js package to display an image gallery lightbox

Stats

StarsIssuesVersionUpdatedCreatedSize
@likecoin/vue-image-lightbox
205.5.43 years ago4 years agoMinified + gzip package size for @likecoin/vue-image-lightbox in KB

Readme

vue-image-lightbox

!!! Fork of https://github.com/pexea12/vue-image-lightbox, removing v-touch and swipe function.

##Original README A simple image lightbox component for Vuejs
NPM Package

I use CSS style from react-images

Demo!

Development (NPM / Yarn)

npm run dev
yarn dev

Install

NPM / Yarn

Install the package:

npm install vue-image-lightbox vue-lazyload vue-touch@next
yarn add vue-image-lightbox vue-lazyload vue-touch@next

Then import it in your project At your entry point (main.js normally)

import Vue from 'vue'
import VueLazyLoad from 'vue-lazyload'
...
Vue.use(VueLazyLoad)

and use the lightbox:

import Lightbox from 'vue-image-lightbox'

export default {
  components: {
    Lightbox,
  },
}

Browser global

<script src="path/to/vue.js"></script>
<script src="path/to/dist/vue-image-lightbox.js"></script>

Usage

You can simply view App.vue to see how to use vue-image-lightbox

Import CSS style

require('vue-image-lightbox/dist/vue-image-lightbox.min.css')
// Use only when you are using Webpack

How to use:

<lightbox :images="images"></lightbox>

images has the structure:

[
  {
    thumb: 'http://example.com/thumb.jpg',
    src: 'http://example.com/image.jpg',
    caption: 'caption to display. receive <html> <b>tag</b>', // Optional
  }
]

Options

Properties

name type default description
images Array required Image array to display
showLightBox Boolean true Whether to show lightbox or not at the beginning
startAt Number 0 Index of the image that you want to start at
nThumbs Number 7 Number of thumnail images
showThumbs Boolean true Whether to show thumbnails or not
autoPlay Boolean false Move to next image automatically
autoPlayTime Number 3000 (ms) Time to stop at an image before move on to next image
siteLoading null default image when your image is error or loading
showCaption Boolean false Whether to show caption or not

Methods

name arguments description
nextImage () Move to next image
previousImage () Move to previous image
closeLightBox () Close lightbox
showImage (index) Show the image at index

CREDITS

Most of the CSS belongs to react-images

Contributors:

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.