All Projects â†’ NickKaramoff â†’ vue-tinybox

NickKaramoff / vue-tinybox

Licence: MIT license
🌌 A slick, yet tiny lightbox gallery for Vue.js

Programming Languages

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

Projects that are alternatives of or similar to vue-tinybox

Lightgallery.js
Full featured JavaScript image & video gallery. No dependencies
Stars: ✭ 5,168 (+5456.99%)
Mutual labels:  gallery, lightbox
hes-gallery
Light, dependency free, responsive gallery script
Stars: ✭ 27 (-70.97%)
Mutual labels:  gallery, lightbox
React Grid Gallery
Justified image gallery component for React
Stars: ✭ 571 (+513.98%)
Mutual labels:  gallery, lightbox
React Native Gallery Toolkit
Reanimated 2 powered gallery implementation
Stars: ✭ 379 (+307.53%)
Mutual labels:  gallery, lightbox
Silentbox
A lightbox inspired Vue.js component.
Stars: ✭ 196 (+110.75%)
Mutual labels:  gallery, lightbox
Ngx Gallery
Angular Gallery, Carousel and Lightbox
Stars: ✭ 417 (+348.39%)
Mutual labels:  gallery, lightbox
Spotlight
Web's most easy to integrate lightbox gallery library. Super-lightweight, outstanding performance, no dependencies.
Stars: ✭ 799 (+759.14%)
Mutual labels:  gallery, lightbox
Glightbox
Pure Javascript lightbox with mobile support. It can handle images, videos with autoplay, inline content and iframes
Stars: ✭ 702 (+654.84%)
Mutual labels:  gallery, lightbox
Baguettebox.js
âš¡ Simple and easy to use lightbox script written in pure JavaScript
Stars: ✭ 2,252 (+2321.51%)
Mutual labels:  gallery, lightbox
Vue Pure Lightbox
Very simple lightbox plugin (without any dependencies) for Vuejs 🌅
Stars: ✭ 142 (+52.69%)
Mutual labels:  gallery, lightbox
Simple React Lightbox
A simple but functional light-box for React.
Stars: ✭ 265 (+184.95%)
Mutual labels:  gallery, lightbox
react-simple-image-viewer
Simple image viewer component for React
Stars: ✭ 44 (-52.69%)
Mutual labels:  gallery, lightbox
Zoomwall.js
A content-focused photo gallery using a horizontal masonry layout that scales up in lightbox mode.
Stars: ✭ 254 (+173.12%)
Mutual labels:  gallery, lightbox
Nanogallery2
a modern photo / video gallery and lightbox [JS library]
Stars: ✭ 488 (+424.73%)
Mutual labels:  gallery, lightbox
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 (+91.4%)
Mutual labels:  gallery, lightbox
Natural Gallery Js
A lazy load, infinite scroll and natural layout list gallery
Stars: ✭ 93 (+0%)
Mutual labels:  gallery, lightbox
fancybox
jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable.
Stars: ✭ 7,261 (+7707.53%)
Mutual labels:  gallery, lightbox
gatsby-image-gallery
Very basic gallery grid based on gatsby-image
Stars: ✭ 116 (+24.73%)
Mutual labels:  gallery, lightbox
react-lightgallery
React wrapper for lightgallery.js
Stars: ✭ 46 (-50.54%)
Mutual labels:  gallery
Odyssey
Next generation gallery. Exceptional images deserve an exceptional presentation.
Stars: ✭ 29 (-68.82%)
Mutual labels:  gallery

vue-tinybox

Milky Way emoji

A slick, yet tiny lightbox gallery for Vue.js

  • Slick. No excessive design. Pictures, thumbnails, controls.
  • Tiny. Dependency-free. 3 KB minified and gzipped.
  • Adaptive. Works on computers. Works on tablets. Works on phones.

Demo

Observe the live demo here: os.karamoff.dev/vue-tinybox

Basic usage

<Tinybox
    v-model="index"
    :images="images"
    loop
    no-thumbs
/>

Install

Browsers

  1. Include the link to Tinybox in <head> alongside Vue.js:

    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue-tinybox"></script>
  2. Tinybox will auto-install upon detecting the global Vue instance. You can use it right away.

Node environment

  1. Install the Tinybox package:

    npm install vue-tinybox
    # or
    yarn add vue-tinybox
  2. Register it as you usually would:

    import Tinybox from "vue-tinybox";
    // or
    const Tinybox = require('vue-tinybox');
    
    
    Vue.component('Tinybox', Tinybox);
    //or
    Vue.use(Tinybox);
    //or
    new Vue({
        components: { Tinybox },
        // ... 
    });

API

Image object

An Image object is an object with following fields:

Field name Type Description
src String Image URL
thumbnail String (optional) Thumbnail URL. If omitted, the image URL will be used
caption String (optional) Caption text to be overlayed on the image
alt String (optional) Alt text. If omitted, the caption will be used

Props

Prop name Type Default Description
images Array [] List of either image URLs or Image objects
loop Boolean false Indicates whether the images should loop
no-thumbs Boolean false When enabled, the thumbnails are hidden

v-model

You can use v-model on a Number variable, which will hold the index of the image currently open. If no image is open (i.e. Tinybox is closed), the value becomes null.

Instead of v-model you can use the index prop and change event:

<Tinybox
    v-model="index"
    :images="images"
/>

<!-- is equivalent to -->

<Tinybox
    :images="images"
    :index="index"
    @change="(i) => {index = i}"
/>

Events

Event name Payload Description
change index of the image changed to Is emitted on any image change (thumbnail navigation, prev/next, close)
prev/next index of the image changed to Is emitted specifically when the user clicks "Prev"/"Next" or presses Left/Right arrow key
close index of the image Tinybox was closed at Is emitted specifically when the user clicks "Close" or presses the Esc key

Events can come in handy for business logic cases:

<Tinybox
    :images="images"
    v-model="index"
    @change="onChange"
    @prev="onPrevious"
    @next="onNext"
    @close="onClose"
/>
export default {
    // ...
    methods: {
        onChange(index) {
            console.log("User navigated to the photo: ", index);
        },
        onPrevious(index) {
            console.log("User clicked 'previous' to switch to: ", index);
        },
        onNext(index) {
            console.log("User clicked 'previous' to switch to: ", index);
        },
        onClose(index) {
            console.log("User closed TinyBox on this photo: ", index);
        }
    },
}

Browser support

Chrome Firefox Safari MS Edge Internet Explorer
21+ 28+ 7+ 16+ 11
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].