All Projects → haiafara → vue-it-bigger

haiafara / vue-it-bigger

Licence: Apache-2.0 license
A simple image / (YouTube) video lightbox component for Vue.js.

Programming Languages

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

Projects that are alternatives of or similar to vue-it-bigger

Magnify
🖼 A jQuery plugin to view images just like in Windows. Browser support IE7+!
Stars: ✭ 177 (+1.72%)
Mutual labels:  lightbox
body-scroll-freezer
↕️ Dependency-free JS module to freeze body scroll when opening modal box
Stars: ✭ 22 (-87.36%)
Mutual labels:  lightbox
grav-plugin-featherlight
Grav Featherlight Plugin
Stars: ✭ 29 (-83.33%)
Mutual labels:  lightbox
Fluidbox
Replicating and improving the lightbox module seen on Medium with fluid transitions.
Stars: ✭ 2,162 (+1142.53%)
Mutual labels:  lightbox
Photoviewer
🌀 A JS plugin to view images just like in Windows.
Stars: ✭ 203 (+16.67%)
Mutual labels:  lightbox
MultiDialog
MultiDialog utilizes jQuery UI Dialog Widget for a full featured Modalbox / Lightbox application.
Stars: ✭ 23 (-86.78%)
Mutual labels:  lightbox
Lightbox
A lightbox gallery plugin for Bootstrap
Stars: ✭ 1,866 (+972.41%)
Mutual labels:  lightbox
hes-gallery
Light, dependency free, responsive gallery script
Stars: ✭ 27 (-84.48%)
Mutual labels:  lightbox
Mini Rpc
Spring + Netty + Protostuff + ZooKeeper 实现了一个轻量级 RPC 框架,使用 Spring 提供依赖注入与参数配置,使用 Netty 实现 NIO 方式的数据传输,使用 Protostuff 实现对象序列化,使用 ZooKeeper 实现服务注册与发现。使用该框架,可将服务部署到分布式环境中的任意节点上,客户端通过远程接口来调用服务端的具体实现,让服务端与客户端的开发完全分离,为实现大规模分布式应用提供了基础支持
Stars: ✭ 205 (+17.82%)
Mutual labels:  lightbox
react-simple-image-viewer
Simple image viewer component for React
Stars: ✭ 44 (-74.71%)
Mutual labels:  lightbox
Tobi
An accessible, open-source lightbox with no dependencies.
Stars: ✭ 195 (+12.07%)
Mutual labels:  lightbox
Silentbox
A lightbox inspired Vue.js component.
Stars: ✭ 196 (+12.64%)
Mutual labels:  lightbox
react-layer-stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 158 (-9.2%)
Mutual labels:  lightbox
Baguettebox.js
⚡ Simple and easy to use lightbox script written in pure JavaScript
Stars: ✭ 2,252 (+1194.25%)
Mutual labels:  lightbox
gatsby-image-gallery
Very basic gallery grid based on gatsby-image
Stars: ✭ 116 (-33.33%)
Mutual labels:  lightbox
Featherlight
Featherlight is a very lightweight jQuery lightbox plugin. It's simple yet flexible and easy to use. Featherlight has minimal css and uses no inline styles, everything is name-spaced, it's completely customizable via config object and offers image, ajax and iframe support out of the box. Featherlights small footprint weights about 4kB – in total.
Stars: ✭ 2,037 (+1070.69%)
Mutual labels:  lightbox
fancybox
jQuery lightbox script for displaying images, videos and more. Touch enabled, responsive and fully customizable.
Stars: ✭ 7,261 (+4072.99%)
Mutual labels:  lightbox
react-google-photo
React lightbox component using the google photo style
Stars: ✭ 18 (-89.66%)
Mutual labels:  lightbox
mini-rpc
Spring + Netty + Protostuff + ZooKeeper 实现了一个轻量级 RPC 框架,使用 Spring 提供依赖注入与参数配置,使用 Netty 实现 NIO 方式的数据传输,使用 Protostuff 实现对象序列化,使用 ZooKeeper 实现服务注册与发现。使用该框架,可将服务部署到分布式环境中的任意节点上,客户端通过远程接口来调用服务端的具体实现,让服务端与客户端的开发完全分离,为实现大规模分布式应用提供了基础支持
Stars: ✭ 221 (+27.01%)
Mutual labels:  lightbox
takefive.css
The most advanced pure CSS lightbox – not one single line of JavaScript has been wasted
Stars: ✭ 123 (-29.31%)
Mutual labels:  lightbox

Vue It Bigger!

npm Build Status codecov Depfu

A simple image / (YouTube) video lightbox component for Vue.js. Based on vue-image-lightbox.

Vue It Bigger Screenshot

Click on the screenshot above for a demo.

Features

  • Unobtrusive interface that disappears after a few seconds, reappears on mouse activity
  • Optional thumbnail strip with all of the gallery's media
  • Can show an HTML enabled caption under each image or video
  • Can play the slideshow automatically
  • All of the graphics (previous, next and close buttons) can be customized via slots
  • Can skip to next / previous media programatically

Improvements over vue-image-lightbox

  • Allows embedding YouTube videos
  • Lightbox opens and closes with a short fade
  • Media's width is no longer limited (stretches to the full width / height of the window)
  • When opening the lightbox the media doesn't flicker
  • Moved caption bar and image counter off the media to the bottom of the screen
  • Moved thumbnails to the top of the screen (as the bottom is now used by the caption bar)
  • All interface elements have a background for better visibility
  • Simplified CSS

Installation

You know the drill:

npm install vue-it-bigger
yarn add vue-it-bigger

Usage

You can view App.vue or the demo for an usage example.

In the <script> section of your component import it:

import LightBox from 'vue-it-bigger'
import('vue-it-bigger/dist/vue-it-bigger.min.css') // when using webpack

Add it to the list of used components:

export default {
  components: {
    LightBox,
  },
}

And use it in the <template> section:

<LightBox :media="media"></LightBox>

The media prop has the following structure:

[
  { // For an image
    type: 'image', // Can be omitted for image
    thumb: 'http://example.com/thumb.jpg',
    src: 'http://example.com/image.jpg',
    caption: 'Caption to display. HTML <b>enabled</b>', // Optional
    srcset: '...' // Optional for displaying responsive images
  },
  { // For a YouTube video
    type: 'youtube',
    thumb: 'https://img.youtube.com/vi/WsptdUFthWI/hqdefault.jpg',
    id: 'WsptdUFthWI',
    caption: 'HTML <b>enabled</b> caption to display' // Optional
  },
  { // For a video that can be played in the <video> tag
    type: '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'
      }
    ],
    caption: '<h4>Monsters Inc.</h4>',
    width: 800, // Required
    height: 600, // Required
    autoplay: true // Optional: Autoplay video when the lightbox opens
  }
]

Using it with NuxtJs

Create a file named lightbox.js under the plugins directory with following contents:

import Vue from 'vue'

import LightBox from 'vue-it-bigger'
import('vue-it-bigger/dist/vue-it-bigger.min.css')

const plugin = {
  install() {
    Vue.component('LightBox', LightBox)
  },
}

Vue.use(plugin)

Add the plugin in nuxt.config.js:

plugins: [
  {
    src: '~/plugins/lightbox.js',
    ssr: false
  }
]

Use it in any of your components:

<no-ssr placeholder="Loading...">
  <!-- this component will only be rendered on client-side -->
  <LightBox
    :media="lightBoxMedia"
  ></LightBox>
</no-ssr>

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
interfaceHideTime Number 3000 (ms) Time after which the interface is hidden
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

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 props
name type description
current integer Number of the current image displayed
total integer Number of images

previous

The previous button on the main image.

next

The next button on the main image.

customCaption

The caption of the current image.

Slot props
name type description
currentMedia Object The currently displayed object from the media array

Usage example:

<LightBox
  ref="customCaptionLightbox"
  :media="media"
  :show-caption="true"
>
  <template v-slot:customCaption="slotProps">
    {{ slotProps.currentMedia.caption }}<br>
    There could be some description here.
  </template>
</LightBox>

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 the startAt index (specified in the properties).
  • onLoad: Emit when there are lengthToLoadMore images left in the array (specified in the properties). For example, if lengthToLoadMore = 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.

Development (NPM / Yarn)

Clone the repository, cd into it and run:

npm run dev
yarn dev

After you add or modify something make sure the tests still pass:

npm run test
yarn test

Credits

License

This project is licensed under the the Apache License, Version 2.0.

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].