Vue-cool-lightbox is a pretty Vue.js lightbox component, inspired by fancybox with zoom, swipe, captions and videos supported

Overview

Vue-cool-lightbox

Vue-cool-lightbox is a pretty Vue.js lightbox component, inspired by fancybox with zoom, swipe, captions and videos supported.

Vue CoolLightbox screenshot

Installation

Use npm to install vue-cool-lightbox.

npm install --save vue-cool-lightbox

and use the lightbox:

import CoolLightBox from 'vue-cool-lightbox'
import 'vue-cool-lightbox/dist/vue-cool-lightbox.min.css'

export default {
  components: {
    CoolLightBox,
  },
}

Docs

You can see the complete documentation with examples here: https://vue-cool-lightbox.lucaspulliese.com/.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT

Donate

I am very happy with the feedback from the community and it makes me want to continue working on this component and create more, so any help is welcome.

Donate here

Comments
  • Slot for content / PDF support

    Slot for content / PDF support

    I was looking for the possibility to show one more PDF I couldn't find it... it would be good if there was a SLOT to be able to place the content you want.

    enhancement 
    opened by elalekey 30
  • Toggle functionality

    Toggle functionality

    It is great to have all the different slideshow options (zoom, thumbnails, etc.). However, for a more minimal version I would love to be able to toggle each option on and off / setting each to true or false. For some elements I can do a workaround by customizing the CSS, for example setting toolbar elements to display: none. But in particular I would like to switch off the zoom functionality when clicking on an enlarged image. Is there a way to do this right now? Otherwise I would find it a very useful enhancement to have several toggle options.

    opened by nncrns 11
  • Issues when adding to nuxt project

    Issues when adding to nuxt project

    Hi, I don't know why this happen , but when i add this package to my nuxt project and go to dev mode it starts showing errors about core-js , here is the gist showing the error can you guess why it happens ? I did test this several times by adding and removing it to the same project only and this package made it happen. thanks

    enhancement 
    opened by jd1378 11
  • How to replace default video player with plyr.js ?

    How to replace default video player with plyr.js ?

    With fancybox you could do something like this in pure js

    window.Plyr = require('plyr/src/js/plyr');
    
    $("[data-fancybox]").fancybox({
        afterShow: function() {
            const player = new Plyr.setup('.fancybox-video', {});
        }
    });
    

    but with vue-cool-lightbox i can do it like this

    <template>
          <CoolLightBox
            :items="data"
            :index="imageIndex"
            :effect="'fade'"
            :use-zoom-bar="true"
            @close="imageIndex = null"
            @on-open="plyr"
          >
          </CoolLightBox>
    </template>
    
    <script>
    import Plyr from 'plyr'
    import 'plyr/dist/plyr.css'
    
    export default {
      methods: {
        plyr() {
          return Plyr.setup('.cool-lightbox-video')
        }
      },
    }
    </script>
    

    it works, but when i click the middle play button, then the lightbox is closing same for the bottom left play button or other plyr interaction buttons see video for demonstration

    https://user-images.githubusercontent.com/73314940/112304300-9e636400-8c9d-11eb-9bfc-39bfc9998d0a.mp4

    Youtube link: https://youtu.be/ETddGVtEQbk

    opened by kgnfth 10
  • Mobile swiping feedback

    Mobile swiping feedback

    Hi, First some credits to this package, it comes really close to Fancybox in my opinion. However, swiping on mobile isn't as user friendly as I hoped for.

    For instance in Fancybox:

    • Swiping up is closing the popup (now it scrolls the page behind)
    • Swiping left or right leads to moving the image according to your movement, it feels snappy. (now it could scroll the page behind if not swiped perfectly horizontally)

    Are there any plans for optimizing this behavior?

    2.0 
    opened by peterknijff 9
  • Background changes on page scroll

    Background changes on page scroll

    Hi, great work.

    I'm having a problem when displaying the lightbox when the page has scrolled down from the original position of the component. I'm programmatically opening the lightbox from different parts of the page, and passing in different images.

    The problem is that half the background is cut off.

    "nuxt": "^2.14.5", "vue-cool-lightbox": "^2.5.2", "@nuxtjs/vuetify": "^1.11.2",

    To reproduce: https://pastebin.pl/view/221c71ca

    opened by hkimani 8
  • Support

    Support "No Cookie" mode

    YouTube offers an API for embed videos with less cookies:

    https://www.youtube-nocookie.com/embed/YOUTUBE_ID

    Unfortunately, this does not work for this lightbox. In terms of data protection, this would be very relevant for European countries. Any chance to support this?

    enhancement 
    opened by migo315 8
  • Add drag and I love it.

    Add drag and I love it.

    Actually I think drag/swipe is really feature that is missing. Other than that I really like it, but it cant be used if there is no swipe for mobile devices :/

    enhancement 
    opened by isuke01 8
  • Body scroll error

    Body scroll error

    Hi, This package is awesome. Thank you for creating it. I only have one issue with it. It keeps throwing error in the console:

    bodyScrollLock.esm.js?e181:192 enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.

    I am using chrome on windows 10.

    Any ideas on how to fix this?

    bug 
    opened by zachu90 7
  • opening the gallery causes underlying page to scroll to the top

    opening the gallery causes underlying page to scroll to the top

    Ideally, when I click on an image/video, the underlying page should not scroll to the top. When I click out of the image/video, I expect the underlying page to look exactly the same as before I clicked the image. Instead, the underlying page is scrolled to the top.

    bug 
    opened by petermanlwl 7
  • Video URL that does not have an extension is not working

    Video URL that does not have an extension is not working

    In my case, the server would send a url that looks something like https://example.com/v1/media/abcdef?query=123. I dug into the source code and found a function called getVideoUrl where it return false for url that isnt youtube,video, or end with some extension.

    I did specify the mediaType to 'video', therefore, it should just return the url instead of false as a fallback. Thank you.

    bug 
    opened by pisethx 6
  • (fix) Avoid sometimes throwing the exceptions when the image list is …

    (fix) Avoid sometimes throwing the exceptions when the image list is …

    I'm using nuxt content to render the page and sometimes it throws an exception that the childnodes are empty, which causes my whole page to go blank.

    I not sure how to trigger, maybe the page hasn't finished loading yet, but I mouse clicked around

    I've added a way to avoid throwing this exception by determining in advance if the childnode is empty

    opened by charles-liang 2
  • Integration with nuxtjs3

    Integration with nuxtjs3

    Do you have an integration example for nuxtjs3 ?

    the current conf is not working

    this is what i tested

    create a plugin useCoolLightBox.client.js

    import { defineNuxtPlugin } from '#app'
    import CoolLightBox from "vue-cool-lightbox";
    
    export default defineNuxtPlugin(nuxtApp => {
    	nuxtApp.vueApp.use(CoolLightBox)
    })
    

    and try to use it in front

    <template>
    		<div class="col-12">
    						<CoolLightBox :items="images" :index="index" @close="index = null">
    						</CoolLightBox>
    
    						<div class="images-wrapper">
    							<div class="image">
    								<img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg"/>
    								<img src="https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg"/>
    							</div>
    						</div>
    </template>
    <script lang="ts" setup>
    const images = ref(["https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg","https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885__340.jpg"])
    </script>
    
    

    this error in console

    Uncaught (in promise) TypeError: Cannot read properties of undefined (reading '_c') at Proxy.vue_render (vue-cool-lightbox.esm.js:1816:91) at renderComponentRoot (runtime-core.esm-bundler.js:898:44) at hydrateSubTree (runtime-core.esm-bundler.js:5603:44) at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5624:25) at ReactiveEffect.run (reactivity.esm-bundler.js:187:25) at instance.update (runtime-core.esm-bundler.js:5745:56) at setupRenderEffect (runtime-core.esm-bundler.js:5759:9) at mountComponent (runtime-core.esm-bundler.js:5541:9) at hydrateNode (runtime-core.esm-bundler.js:4730:21) at hydrateChildren (runtime-core.esm-bundler.js:4869:24) Thanks

    opened by leccyril 2
  • Bump decode-uri-component from 0.2.0 to 0.2.2

    Bump decode-uri-component from 0.2.0 to 0.2.2

    Bumps decode-uri-component from 0.2.0 to 0.2.2.

    Release notes

    Sourced from decode-uri-component's releases.

    v0.2.2

    • Prevent overwriting previously decoded tokens 980e0bf

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.1...v0.2.2

    v0.2.1

    • Switch to GitHub workflows 76abc93
    • Fix issue where decode throws - fixes #6 746ca5d
    • Update license (#1) 486d7e2
    • Tidelift tasks a650457
    • Meta tweaks 66e1c28

    https://github.com/SamVerschueren/decode-uri-component/compare/v0.2.0...v0.2.1

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Single video on click

    Single video on click

    How can I load single video by clicking on it?

    <div v-on:click="startVideo(post.media_url)" class="ratio ratio-16x9">
        <video autoplay muted>
            <source :src="post.media_url" type="video/mp4">
        </video>
    </div>
    
    ///////////
    
    components: {
        CoolLightBox
    },
    methods: {
        startVideo(url) {
            var gallery = [{
                src: url,
                autoplay: true
            }];
            // Then what should be here to load video?
        },
    }
    
    opened by robertnicjoo 0
  • Image path url

    Image path url

    I use gridsome for my application but the images in the lightbox not shown

    what is the correct url to render the image for lightbox. It only works with absolute live path. Images are stored in dev mode in /assets/images/.... after the gridsome build command in /asssets/img/...

    new image name after build process assets/img/berg-1.175db75e.jpg

    components: { CoolLightBox, }, data() { return { items: [ { title: 'a beautiful mountain view', description: "", src: '~@/images/products/schlossberg/berg-1.jpg', }, { title: 'a beautiful mountain view', description: "", src: '~@/images/products/schlossberg/berg-2.jpg', }, { title: 'a beautiful mountain view', description: "", src: '~@/images/products/schlossberg/berg-3.jpg', }, { title: 'a beautiful mountain view', description: "", src: '~@/images/products/schlossberg/berg-5.jpg', }, ], index: null } },

    opened by nothinghalosix 0
  • Support for multiple image formats (webp, avif)

    Support for multiple image formats (webp, avif)

    I integrated next gen images format and this packages has no way to use multiple formats for the image (using tag). Would be nice to have this support.

    Update:

    Actually I see that there is support for picture tag, however it doesn't work properly for my case, here is example of using the component:

        <cool-light-box
          v-if="!['sm', 'md'].includes(screenSize)"
          :items="venue.photos.map(p => ({
            src: p.photo_rectangular,
            picture: {
              sources: [
                {srcset: p.photo_rectangular_webp, type: 'image/webp'},
                {srcset: p.photo_rectangular, type: 'image/jpeg'},
              ],
            },
          }))"
          :index="index"
          @close="index = null"
        />
    

    It generates correct picture tag, however it still loading all the jpeg images, I think there is some issue with lazy loading and how browser responds when srcset and src are replaces. My suggestion is just to add loading="lazy" to img tag instead of using own custom lazy loading solution, as it may not work properly with tag.

    This is images initially loaded on page: https://monosnap.com/file/DPoVXb0LLONsX0C0KRvWMsUFo7dWOs all webp. This is when I open lightbox: https://monosnap.com/file/yl7UpnNxLPKRe5Faou8HwRrkFHvatA it loads all jpegs instead. This is rendered picture tag in the lightbox which is correct: https://monosnap.com/file/XxHlHOvEjLQbpncY2NetKGueuseF6z But still it loads jpegs.

    opened by vedmant 0
A lightbox inspired Vue.js component.

A second version of the lightweight lightbox inspired component for Vue.js with local video support and more features coming. If you're interested, see demo.

Martin Rocek 271 Dec 27, 2022
A lightweight lightbox inspired component for Vue.js

A lightweight lightbox inspired component for Vue.js

我是笨蛋小扁担 0 May 28, 2021
Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js

Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js

mirari 2.1k Dec 27, 2022
Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js

v-viewer Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js Live demo Examples directive component thumbnail

hua chen yu 0 Dec 3, 2020
Image viewer component for vue 3.x, supports rotation, scale, zoom and so on, based on viewer.js

v-viewer Image viewer component for vue, supports rotation, scale, zoom and so on, based on viewer.js v-viewer for vue2 Live demo Quick Example direct

mirari 14 Oct 29, 2022
Lightweight responsive image zoom component for Vue.js 2

Vue Image Zoomer Lightweight responsive image zoom component for Vue.js 2, that also works on touch devices. Perfect for zooming on product images on

Sam Jones 40 Dec 24, 2022
vue zoom component

vue zoom component

Alexander Vysotsky 2 Oct 11, 2021
🔍 Vue image zoom component

vue-magnifier This is a Vue 3 adaptation of react-magnifier, which is the original version. Someone else made a Svelte version, called svelte-magnifie

Website Beaver 3 Aug 9, 2022
A directive supported plugin for PhotoSwipe in Vue.js components.

vue-photoswipe.js A directive supported plugin for PhotoSwipe in Vue.js components. install npm i vue-photoswipe.js -s Import photoswipe component and

Emil Zhai 1 Jul 6, 2020
KéMeet is a Simple, beautiful, fast and secured Open-source zoom alternative, 100% FREE forever!

KéMeet is a Simple, beautiful, fast and secured Open-source zoom alternative, 100% FREE forever! Simply enter a meeting room ID and connect to anyone else in that room! You can even share your screen if you are on desktop!

fotiecodes 31 Jul 6, 2022
Vue Prettybox - a tool dependency that allows you to open or zoom image just by click it

Vue Prettybox - a tool dependency that allows you to open or zoom image just by click it. It helps you to view the image to have a better look of it without making zoom in on your browser.

Israel De Castro A. 2 Aug 7, 2022
A lightweight image, video and iframe lightbox gallery component for Vue

A lightweight image, video and iframe lightbox gallery component for Vue. Supports slide, zoom, rotation, autoplay, captions and so on.

Mervin 3 Aug 30, 2022
A native Vue.js lightbox component

vlightbox Simple native Vue.js lightbox

Oliver Taylor 34 Sep 11, 2022
Lightbox Photo Grid and Slideshow compoment for Vue.JS

Lightbox Photo Grid and Slideshow component for Vue.JS v-lightbox is a Vue component which allows to display first x (1-5) images of your gallery in a

Morioh Lab 78 Nov 27, 2022
Mobile-friendly picture file input Vue.js component with image preview, drag and drop, EXIF orientation, and more.

vue-picture-input Mobile-friendly picture file input Vue.js component with image preview, drag and drop, EXIF orientation, and more. Installation npm

Robert 0 Jun 14, 2018
Vue component that provides content scrolling and zooming using mouse events or two fingers pinch on a mobile devices

Vue component that provides content scrolling and zooming using mouse events or two fingers pinch on a mobile devices

CoddiCat 24 Sep 9, 2022
Friendly Captcha component for Vue 2 and 3

Vue Friendly Captcha Wrapper component library for Friendly Challenge. Works with Vue 2 and 3. Getting Started 1. Install the package Vue 2.x: npm ins

Somus 6 Jun 14, 2022
Lightweight and simple image gallery component for Vue.js

vue-image-box Description Lightweight and simple-ish image gallery component for Vue.js. Images can also be cycled through using the left & right arro

Adam Romig 2 Oct 3, 2021
A Vue 3 component that displays a basic Instagram feed using Instagram Basic Graph API and your Facebook access token.

A Vue 3 component that displays a basic Instagram feed using Instagram Basic Graph API and your Facebook access token.

Saul Gooding 8 Dec 12, 2022