• Stars
    star
    383
  • Rank 111,995 (Top 3 %)
  • Language Vue
  • License
    MIT License
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ–ผ Vue Picture Swipe Gallery (a gallery of image with thumbnails, lazy-load and swipe) backed by photoswipe

Vue Picture Swipe Gallery

Codacy Badge npm download npm version Package Quality vue2 MIT License

This component is a simple wrapper for the awesome Photoswipe. It's a Vue plugin that displays a gallery of image with swipe function (and more). Includes lazy (smart) loading (mobile friendly) and thumbnails.

Demo

Install

npm install --save vue-picture-swipe

Usage

You can use it as you want. Here are some examples if you want to use it inline, or in a .vue file component or even with Laravel.

Inline usage

You can using it inline:

<vue-picture-swipe :items="[
    {src: 'http://example.org/xl.jpg',thumbnail: 'http://example.org/sm1.jpg',w: 600,h: 400, title: 'Will be used for caption'},
    {src: 'http://example.org/xxl.jpg',thumbnail: 'http://example.org/sm2.jpg',w: 1200,h: 900}
  ]"></vue-picture-swipe>

Just remember to register the component:

import VuePictureSwipe from 'vue-picture-swipe';
Vue.component('vue-picture-swipe', VuePictureSwipe);

new Vue({
  el: '#app'
})

Usage in another component

Create a component Example.vue. Then paste this:

<template>
  <vue-picture-swipe :items="items"></vue-picture-swipe>
</template>
<script>
  import VuePictureSwipe from 'vue-picture-swipe';
  export default {
    data() {
      return {
        items: [{
          src: 'http://via.placeholder.com/600x400',
          thumbnail: 'http://via.placeholder.com/64x64',
          w: 600,
          h: 400,
          alt: 'some numbers on a grey background' // optional alt attribute for thumbnail image
        },
        {
          src: 'http://via.placeholder.com/1200x900',
          thumbnail: 'http://via.placeholder.com/64x64',
          w: 1200,
          h: 900
        }
      ]};
    }
  }
</script>

Usage with Laravel

Edit resources/assets/js/app.js and add this just before the new Vue lines.

import VuePictureSwipe from 'vue-picture-swipe';
Vue.component('vue-picture-swipe', VuePictureSwipe);

Then run your watcher:

npm run watch

Advanced usage

PhotoSwipe options

Use options for Photoswipe options.

<!-- Disable "share" buttons. -->
<vue-picture-swipe :options="{shareEl: false}"></vue-picture-swipe>

PhotoSwipe instance

You can access the PhotoSwipe instance via setting a ref, the instance object is exposed as pswp.

<vue-picture-swipe ref="pictureSwipe"></vue-picture-swipe>
this.$refs.pictureSwipe.pswp

Events

open Attributes Listen to Description
Open none @open Emitted after gallery opens
Close none @close Emitted after gallery closes

Why?

I did not found any vue component that uses thumbnail (smaller version of images) and is mobile-friendly (swipe)

  • This one is documented (and issued) in chinese only and has no thumbnails. Edit: I translated the readme (with google translate) and submitted a PR that was accepted, so now, the documentation is in english)
  • This one is documented (and issued) in chinese too and has no thumbnails either.
  • This one has no documentation.
  • This one is a kind of fork of the previous one
  • ...

So I created mine.

Source: https://xkcd.com/927/

More Repositories

1

laravel-log-viewer

๐Ÿช Laravel log viewer
PHP
3,041
star
2

fast-excel

๐Ÿฆ‰ Fast Excel import/export for Laravel
PHP
1,784
star
3

pg-anonymizer

Dump anonymized PostgreSQL database with a NodeJS CLI
TypeScript
154
star
4

similar-text-finder

๐Ÿ PHP Similar Text Finder aka Fuzzy search. `Did you mean "banana"?`
PHP
132
star
5

laravel-stripe-connect

๐Ÿฆ“ Stripe Connect binding for Laravel
PHP
73
star
6

mysql-xplain-xplain

๐Ÿญ Explain Explainer for MySQL Queries.
PHP
53
star
7

laravel-epilog

๐Ÿˆ IP, referer, user ID and more in Laravel logs
PHP
25
star
8

taskz

๐Ÿก Sequential and parallel task list runner for terminal
JavaScript
23
star
9

laravel-prod-server

Install and run a production server for a Laravel application
22
star
10

create-user-command

๐Ÿฆ€ Create User with artisan
PHP
21
star
11

vue-quiz

Create a quiz withย Vue.js
HTML
20
star
12

laravel-credit-card-validator

๐Ÿฅ Laravel Credit Card Validator
PHP
19
star
13

landscape

Procedural landscape
Rust
17
star
14

jacky

๐Ÿ„ HTTP JSON API Client for Laravel & Lumen
PHP
17
star
15

llamassacre

Uncommented-spaghettiesque-dirty code. RUN AWAY.
Rust
15
star
16

remove-stop-words

Remove stop words from a string
PHP
15
star
17

htmltopdf

html to pdf website using wkhtmltopdf
Rust
9
star
18

vue-calendar

HTML
8
star
19

mongodb-anonymizer

Anonymize MongoDB database with a NodeJS CLI
TypeScript
8
star
20

uuid-rule

UUID validation rule for Laravel
PHP
7
star
21

mongodb-elasticsearch-sync

Copy data from MongoDB to Elasticsearch with a NodeJS CLI
TypeScript
6
star
22

voltaire

Proof-reading tool for PHP (spell checker, grammar fixer using LanguageTool)
PHP
6
star
23

facteur

Laravel deployer
Rust
4
star
24

nestor

๐Ÿน Do task, rollback if something goes wrong. Just like database transactions.
PHP
4
star
25

convert-accent-characters

Converts all UTF-8 accent characters to ASCII characters
PHP
4
star
26

midikaos

๐ŸŽท Standard MIDI Files Library website
TypeScript
3
star
27

glitcher-web

๐ŸŽต WAV glitcher, generate broken beats from sample loops
TypeScript
3
star
28

csv-to-associative-array

Get your CSV as an associative array
PHP
3
star
29

ortf

Statistiques de /r/france
TypeScript
2
star
30

react-fairy-tale-emoji

JavaScript
2
star
31

fuzzy-dubstep

Jeu HTML5/JS avec Quintus (+PHP pour generation) : simulation de prรฉparation de mariage
PHP
2
star
32

mynia

Unicorn name generator
Rust
1
star
33

drum-loop-glitcher-sonic-pi

work in progress
Ruby
1
star
34

find-the-cat

Find and click the cat.
JavaScript
1
star
35

indice

Hints for Laravel errors
Blade
1
star
36

420-bot

PHP
1
star
37

create-elasticsearch-dataset

Create a sample dataset for Elasticsearch with one command
TypeScript
1
star
38

drum-beats

Procedural Drum Beats website
Rust
1
star
39

starfield

Rust
1
star