All Projects → vrajroham → vue-simple-lightbox

vrajroham / vue-simple-lightbox

Licence: MIT License
A Vue.js component for touch-friendly image lightbox for mobile and desktop with simple-lightbox

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vue-simple-lightbox

ui
JavaScript UI component library, includes the latest Fancybox
Stars: ✭ 222 (+282.76%)
Mutual labels:  lightbox
huobi-PC
火币桌面客户端,基于electorn-vue开发
Stars: ✭ 56 (-3.45%)
Mutual labels:  vue2
vue2-animate
A port of Animate.css for use with transitions in Vue.js 2.0 / 3.0 and Alpine.js.
Stars: ✭ 1,338 (+2206.9%)
Mutual labels:  vue2
vue-timeline
a timeline for vue2 and bootstrap3
Stars: ✭ 59 (+1.72%)
Mutual labels:  vue2
Code-VueWapDemo
“Vue教程--Wap端项目搭建从0到1”的源码
Stars: ✭ 19 (-67.24%)
Mutual labels:  vue2
blog-frontend
前后端分离实践----基于Vue2.js框架博客前端
Stars: ✭ 32 (-44.83%)
Mutual labels:  vue2
vue-tiny-lazyload-img
🐌 A small size Vue.js directive for lazy loading images using IntersectionObserver API
Stars: ✭ 91 (+56.9%)
Mutual labels:  vue2
vue-viewload
vue图片懒加载lazyload,依赖vue2.0以上版本。支持图片或者其他资源进入可视区域后加载。
Stars: ✭ 77 (+32.76%)
Mutual labels:  vue2
v-page
A simple pagination bar, including length Menu, i18n support, based on Vue2.x
Stars: ✭ 85 (+46.55%)
Mutual labels:  vue2
v-pip
🖼 Tiny vue wrapper for supporting native picture-in-picture mode.
Stars: ✭ 30 (-48.28%)
Mutual labels:  vue2
v-clappr
👏🏻Vue.js wrapper for Clappr media player
Stars: ✭ 18 (-68.97%)
Mutual labels:  vue2
bpit-vue
vue effects component package 🚀
Stars: ✭ 16 (-72.41%)
Mutual labels:  vue2
v-currency
A plugin for formatting currency for different countries in Vue
Stars: ✭ 24 (-58.62%)
Mutual labels:  vue2
hoc-element-table
📦 A Vue 3.x Table Component built on Webpack 5
Stars: ✭ 26 (-55.17%)
Mutual labels:  vue2
element-ui-saas-extend
基于ElementUI开发的SaaS业务扩展
Stars: ✭ 14 (-75.86%)
Mutual labels:  vue2
vue-crumbs
a simple and useful breadcrumb for Vue2.js
Stars: ✭ 16 (-72.41%)
Mutual labels:  vue2
vue
Vue.js Demos. jQWidgets Vue.js Components - Grids, Charts, Scheduling, Pivot Tables
Stars: ✭ 55 (-5.17%)
Mutual labels:  vue2
vue2-typeahead
A vue component of typeahead
Stars: ✭ 34 (-41.38%)
Mutual labels:  vue2
office-fabric
johannes-z.github.io/office-fabric/
Stars: ✭ 12 (-79.31%)
Mutual labels:  vue2
react-gallery-carousel
Mobile-friendly gallery carousel 🎠 with server side rendering, lazy loading, fullscreen, thumbnails, touch, mouse emulation, RTL, keyboard navigation and customisations.
Stars: ✭ 178 (+206.9%)
Mutual labels:  lightbox

vue-simple-lightbox

A Vue.js component for touch-friendly image lightbox for mobile and desktop powered by Simple Lighbox

LIVE DEMO


Install

// For Vue.js 2.0+
npm install vue-simple-lightbox

Usage

  1. Import the module
  2. Register it as a component as you would any other Vue component
  3. Use it within your template

Example

<template>
  <div id="app">
    <p>Welcome to your Vue.js lightbox!</p>

    <lightbox
      id="mylightbox"
      :images="images"
      :image_class=" 'img-responsive img-rounded' "
      :album_class=" 'my-album-class' "
      :options="options">
    </lightbox>

  </div>
</template>

<script>
  import Lightbox from 'vue-simple-lightbox'

  export default {
    components: {
      Lightbox
    },
    data(){
        return{
          images : [
            {
                src : 'https://cdn.rawgit.com/vrajroham/vrajroham.github.io/85d64ac5/imgs/img1.jpg',
                title : 'Image 2'
            },
            {
                src : 'https://cdn.rawgit.com/vrajroham/vrajroham.github.io/85d64ac5/imgs/img2.jpg',
                title : 'Image 3'
            },
            {
                src : 'https://cdn.rawgit.com/vrajroham/vrajroham.github.io/85d64ac5/imgs/img3.jpg',
                title : ''
            },
            {
                src : 'https://cdn.rawgit.com/vrajroham/vrajroham.github.io/85d64ac5/imgs/img4.jpg',
                title : ''
            },
          ],
          options : {
            closeText : 'X'
          }
        }
      }
  }
</script>

Props

Many of these props are inherited from simplelightbox configuration so see their docs for further details.

Prop Name Type Description
id String A string by which to identify the component, can be anything. Required
images Array Array containing (src,title) Required
image_class String Class for each image
album_class String Class for album. i.e. Group of images (current lightbox)
options Object Options for lightbox (refer following table)

Options

Property Default Type Description
sourceAttr href string the attribute used for large images
overlay true bool show an overlay or not
spinner true bool show spinner or not
nav true bool show arrow-navigation or not
navText ['←','→'] array text or html for the navigation arrows
captions true bool show captions if availabled or not
captionSelector 'img' string set the element where the caption is. Set it to "self" for the A-Tag itself
captionType 'attr' string how to get the caption. You can choose between attr, data or text
captionsData title string get the caption from given attribute
captionPosition 'bottom' string the position of the caption. Options are top, bottom or outside (note that outside can be outside the visible viewport!)
captionDelay 0 int adds a delay before the caption shows (in ms)
close true bool show the close button or not
closeText '×' string text or html for the close button
swipeClose true bool swipe up or down to close gallery
showCounter true bool show current image index or not
fileExt 'png|jpg|jpeg|gif' regexp or false list of fileextensions the plugin works with or false for disable the check
animationSpeed 250 int how long takes the slide animation
animationSlide true bool weather to slide in new photos or not, disable to fade
preloading true bool allows preloading next und previous images
enableKeyboard true bool allow keyboard arrow navigation and close with ESC key
loop true bool enables looping through images
rel false mixed group images by rel attribute of link with same selector.
docClose true bool closes the lightbox when clicking outside
swipeTolerance 50 int how much pixel you have to swipe, until next or previous image
className: 'simple-lightbox' string adds a class to the wrapper of the lightbox
widthRatio: 0.8 float Ratio of image width to screen width
heightRatio: 0.9 float Ratio of image height to screen height
disableRightClick false bool disable rightclick on image or not
disableScroll true bool stop scrolling page if lightbox is opened
alertError true bool show an alert, if image was not found. If false error will be ignored
alertErrorMessage 'Image not found, next image will be loaded' string the message displayed if image was not found
additionalHtml false string Additional HTML showing inside every image. Usefull for watermark etc. If false nothing is added
history true bool enable history back closes lightbox instead of reloading the page

Development

# install dependencies
npm install

# serve example at localhost:8080
npm run dev

# build any changes made
npm run build
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].