pexea12 / Vue Image Lightbox
A Vue component to display an image gallery lightbox
Stars: ✭ 258
Projects that are alternatives of or similar to Vue Image Lightbox
Lightgallery
A customizable, modular, responsive, lightbox gallery plugin.
Stars: ✭ 4,829 (+1771.71%)
Mutual labels: lightbox, image-gallery
Magnify
🖼 A jQuery plugin to view images just like in Windows. Browser support IE7+!
Stars: ✭ 177 (-31.4%)
Mutual labels: lightbox, image-gallery
Lightgallery.js
Full featured JavaScript image & video gallery. No dependencies
Stars: ✭ 5,168 (+1903.1%)
Mutual labels: lightbox, image-gallery
Photoviewer
🌀 A JS plugin to view images just like in Windows.
Stars: ✭ 203 (-21.32%)
Mutual labels: lightbox, image-gallery
Jbox
jBox is a jQuery plugin that makes it easy to create customizable tooltips, modal windows, image galleries and more.
Stars: ✭ 1,251 (+384.88%)
Mutual labels: lightbox, image-gallery
takefive.css
The most advanced pure CSS lightbox – not one single line of JavaScript has been wasted
Stars: ✭ 123 (-52.33%)
Mutual labels: image-gallery, lightbox
vue-simple-lightbox
A Vue.js component for touch-friendly image lightbox for mobile and desktop with simple-lightbox
Stars: ✭ 58 (-77.52%)
Mutual labels: lightbox
vue2
【🔥Vue.js资讯📚】目前web前端开发非常火爆的框架;定时更新,欢迎 Star 一下。
Stars: ✭ 415 (+60.85%)
Mutual labels: vue-components
Vue Spinners
💫 A collection of loading spinner components for Vuejs
Stars: ✭ 255 (-1.16%)
Mutual labels: vue-components
codemirror-editor-vue3
CodeMirror component for Vue3
Stars: ✭ 22 (-91.47%)
Mutual labels: vue-components
vue-notification-bell
Vue.js notification bell component.
Stars: ✭ 64 (-75.19%)
Mutual labels: vue-components
osiris
🎨 A Vue.js 2.0 universal responsive UI component library
Stars: ✭ 36 (-86.05%)
Mutual labels: vue-components
vue-sfc-cli
🔨A powerful tool for developing vue single-file component
Stars: ✭ 137 (-46.9%)
Mutual labels: vue-components
vuejs-components-fundamentals
👩💻Source code for Vue.js Components Fundamentals course
Stars: ✭ 43 (-83.33%)
Mutual labels: vue-components
vui-vc-next
Vue 3 with Vite Playground - Mobile web UI components - (vue3+vite2).
Stars: ✭ 15 (-94.19%)
Mutual labels: vue-components
vue-image-lightbox
A simple image/video lightbox component for Vuejs NPM Package
I use CSS style from react-images
Development (NPM / Yarn)
npm run dev
yarn dev
Install
NPM / Yarn
Install the package:
npm install vue-image-lightbox vue-lazyload
yarn add vue-image-lightbox vue-lazyload
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:
<light-box :media="media"></light-box>
media
has the structure:
[
{ // For image
thumb: 'http://example.com/thumb.jpg',
src: 'http://example.com/image.jpg',
caption: 'caption to display. receive <html> <b>tag</b>', // Optional
srcset: '...' // Optional for displaying responsive images
},
{ // For video
thumb: 'https://s3-us-west-1.amazonaws.com/powr/defaults/image-slider2.jpg',
sources: [
{
src: 'https://www.w3schools.com/html/mov_bbb.mp4',
type: 'video/mp4'
}
],
type: "video",
caption: '<h4>Monsters Inc.</h4>',
width: 800, // required
height: 600, // required
autoplay: true //Optional to autoplay video when lightbox opens
}
]
Options
Properties
name | type | default | description |
---|---|---|---|
media | Array | required | Media 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 thumbnail 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 | String | default image when your image is error or loading | |
showCaption | Boolean | false | Whether to show caption or not |
disableScroll | Boolean | true | set to `true` to avoid scrolling views behind lightbox |
lengthToLoadMore | Number | 0 | Minimum length unto end to emit load more event |
closable | Boolean | true | Display the close button at the right top corner or not. ESC clicking-close will also be disabled if closable is set to false. |
closeText | String | Close (Esc) | Text for the close button |
previousText | String | Previous | Text for the previous image button |
nextText | String | Next | Text for the next image button |
previousThumbText | String | Previous | Text for the previous thumb image button |
nextThumbText | String | Next | Text for the next thumb image button |
showFooterCount | Boolean | true | Show footer count |
Methods
name | arguments | description |
---|---|---|
nextImage | () | Move to next image |
previousImage | () | Move to previous image |
closeLightBox | () | Close lightbox |
showImage | (index) | Show the image at index |
Slots
close
The content of the close button.
footer
The content of the footer under the image.
slot-scopes
name | type | description |
---|---|---|
current | integer | Number of the current image displayed |
total | integer | Numbers of the images |
previous
The previous button on the main image.
next
The next button on the main image.
previousThumb
The previous button on the thumbs list.
nextThumb
The next button on the thumbs list.
customCaption
The caption of the current image.
videoIcon
The Icon used for videos
Events
-
onOpened
: emit when the lightbox is opened. -
onClosed
: emit when the lightbox is closed. -
onLastIndex
: Emit when the current image is the last one of the list. -
onFirstIndex
: Emit when the current image is the first one of the list. -
onStartIndex
: Emit when the current image is at thestartAt
index (specified in the properties). -
onLoad
: Emit when there arelengthToLoadMore
images left in the array (specified in the properties). For example, iflengthToLoadMore = 2
and there are 7 images in your array, when you reach index 4 (which means there are 2 images left which are not discovered yet), this event will be emitted. After that, if the image array are updated and there are totally 15 images, the event will be emitted at index 12. -
onImageChanged
: Emit when the image is changed.
CREDITS
Most of the CSS belongs to react-images
Contributors:
- @imcvampire
- @krystalcampioni
- @jstr14
- @PedroBatista333
- @vtalbot
- @hasangilak
- @neobutter
- @mudin
- @asterisx
- @janosrusiczki janosrusiczki) janosrusiczki]
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].