UNPKG

8.76 kBMarkdownView Raw
1<p align="center">
2<img src="https://cdn.rawgit.com/RobinCK/vue-gallery/a08dae25/doc/gallery.png">
3</p>
4
5<p align="center">
6 <a href="https://opencollective.com/vue-gallery" alt="Financial Contributors on Open Collective"><img src="https://opencollective.com/vue-gallery/all/badge.svg?label=financial+contributors" /></a>
7 <a href="https://github.com/RobinCK/vue-gallery"><img src="https://img.shields.io/badge/vuejs-2.x-brightgreen.svg?style=flat-square"></a>
8 <a href="https://www.npmjs.com/package/vue-gallery"><img src="https://img.shields.io/npm/dt/vue-gallery.svg?style=flat-square"></a>
9</p>
10
11<p align="center">
12 <a href="https://david-dm.org/RobinCK/vue-gallery"><img src="https://david-dm.org/RobinCK/vue-gallery.svg?style=flat-square"></a>
13 <a href="https://david-dm.org/RobinCK/vue-gallery?type=dev"><img src="https://david-dm.org/RobinCK/vue-gallery/dev-status.svg?style=flat-square"></a>
14 <a href="https://github.com/RobinCK/vue-gallery"><img src="https://img.shields.io/npm/v/vue-gallery.svg?style=flat-square"></a>
15 <a href="https://github.com/RobinCK/vue-gallery/blob/master/LICENSE"><img src="https://img.shields.io/npm/l/vue-gallery.svg?style=flat-square"></a>
16
17</p>
18
19# vue-gallery
20
21[![Greenkeeper badge](https://badges.greenkeeper.io/RobinCK/vue-gallery.svg)](https://greenkeeper.io/)
22:camera: VueJS responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.
23
24## Example
25
26[jsFiddle - image](https://fiddle.jshell.net/Robin_ck/LffrLb2k/show/light/)
27
28[jsFiddle - video](https://fiddle.jshell.net/Robin_ck/djqcrm8m/show/light/)
29
30## Install
31#### CDN
32
33Recommended: https://unpkg.com/vue-gallery, which will reflect the latest version as soon as it is published to npm. You can also browse the source of the npm package at https://unpkg.com/vue-gallery/
34
35#### NPM
36
37``` bash
38npm install vue-gallery --save
39```
40
41#### Yarn
42
43``` bash
44yarn add vue-gallery
45```
46## Development Setup
47
48``` bash
49# install dependencies
50npm install
51
52# build dist files
53npm run build
54```
55
56## Usage
57
58### VueJS single file (ECMAScript 2015)
59```html
60<template>
61 <div>
62 <gallery :images="images" :index="index" @close="index = null"></gallery>
63 <div
64 class="image"
65 v-for="(image, imageIndex) in images"
66 :key="imageIndex"
67 @click="index = imageIndex"
68 :style="{ backgroundImage: 'url(' + image + ')', width: '300px', height: '200px' }"
69 ></div>
70 </div>
71</template>
72
73<script>
74 import VueGallery from 'vue-gallery';
75
76 export default {
77 data: function () {
78 return {
79 images: [
80 'https://dummyimage.com/800/ffffff/000000',
81 'https://dummyimage.com/1600/ffffff/000000',
82 'https://dummyimage.com/1280/000000/ffffff',
83 'https://dummyimage.com/400/000000/ffffff',
84 ],
85 index: null
86 };
87 },
88
89 components: {
90 'gallery': VueGallery
91 },
92 }
93</script>
94
95<style scoped>
96 .image {
97 float: left;
98 background-size: cover;
99 background-repeat: no-repeat;
100 background-position: center center;
101 border: 1px solid #ebebeb;
102 margin: 5px;
103 }
104</style>
105
106```
107
108### Browser (ES5)
109```html
110 <script type="text/javascript" src="https://unpkg.com/vue@2.4.3/dist/vue.js"></script>
111 <script type="text/javascript" src="https://unpkg.com/blueimp-gallery@2.27.0/js/blueimp-helper.js"></script>
112 <script type="text/javascript" src="https://unpkg.com/blueimp-gallery@2.27.0/js/blueimp-gallery.js"></script>
113 <script type="text/javascript" src="https://unpkg.com/blueimp-gallery@2.27.0/js/blueimp-gallery-fullscreen.js"></script>
114 <script type="text/javascript" src="vue-gallery.js"></script>
115 <link rel="stylesheet" type="text/css" href="https://unpkg.com/blueimp-gallery@2.27.0/css/blueimp-gallery.min.css">
116
117
118<div id="app">
119 <gallery :images="images" :index="index" @close="index = null"></gallery>
120 <div
121 class="image"
122 v-for="image, imageIndex in images"
123 @click="index = imageIndex"
124 :style="{ backgroundImage: 'url(' + image + ')', width: '300px', height: '200px' }"
125 ></div>
126</div>
127
128<script type="text/javascript">
129 new Vue({
130 el: '#app',
131 data: function () {
132 return {
133 images: [
134 'https://dummyimage.com/800/ffffff/000000',
135 'https://dummyimage.com/1600/ffffff/000000',
136 'https://dummyimage.com/1280/000000/ffffff',
137 'https://dummyimage.com/400/000000/ffffff'
138 ],
139 index: null
140 };
141 },
142
143 components: {
144 'gallery': VueGallery
145 }
146 });
147</script>
148```
149
150## Props
151
152| Props | Type | Default | Description |
153| --------------------|:----------| ------------------------------------------------|--------------|
154| images | Array | [] | Urls list |
155| index | Number | null | Opened image index |
156| options | Object | | [blueimp-gallery](https://github.com/blueimp/Gallery) options |
157
158
159
160## Events
161| Name | Params | Description |
162| -----------------|:------------------------|--------------|
163| onopen | | |
164| onopened | | |
165| onslide | | |
166| onslideend | | |
167| onslidecomplete | | |
168| onclose | | |
169| onclosed | | |
170
171
172## Other my Vue JS plugins
173
174| Project | Status | Description |
175|---------|--------|-------------|
176| [vue-ls](https://github.com/RobinCK/vue-ls) | ![npm](https://img.shields.io/npm/v/vue-ls.svg) | Vue plugin for work with local storage, session storage and memory storage from Vue context |
177| [vue-popper](https://github.com/RobinCK/vue-popper) | ![npm](https://img.shields.io/npm/v/vue-popperjs.svg) | VueJS popover component based on <a href="https://popper.js.org/">popper.js</a> |
178
179## Contributors
180
181### Code Contributors
182
183This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
184<a href="https://github.com/RobinCK/vue-gallery/graphs/contributors"><img src="https://opencollective.com/vue-gallery/contributors.svg?width=890&button=false" /></a>
185
186### Financial Contributors
187
188Become a financial contributor and help us sustain our community. [[Contribute](https://opencollective.com/vue-gallery/contribute)]
189
190#### Individuals
191
192<a href="https://opencollective.com/vue-gallery"><img src="https://opencollective.com/vue-gallery/individuals.svg?width=890"></a>
193
194#### Organizations
195
196Support this project with your organization. Your logo will show up here with a link to your website. [[Contribute](https://opencollective.com/vue-gallery/contribute)]
197
198<a href="https://opencollective.com/vue-gallery/organization/0/website"><img src="https://opencollective.com/vue-gallery/organization/0/avatar.svg"></a>
199<a href="https://opencollective.com/vue-gallery/organization/1/website"><img src="https://opencollective.com/vue-gallery/organization/1/avatar.svg"></a>
200<a href="https://opencollective.com/vue-gallery/organization/2/website"><img src="https://opencollective.com/vue-gallery/organization/2/avatar.svg"></a>
201<a href="https://opencollective.com/vue-gallery/organization/3/website"><img src="https://opencollective.com/vue-gallery/organization/3/avatar.svg"></a>
202<a href="https://opencollective.com/vue-gallery/organization/4/website"><img src="https://opencollective.com/vue-gallery/organization/4/avatar.svg"></a>
203<a href="https://opencollective.com/vue-gallery/organization/5/website"><img src="https://opencollective.com/vue-gallery/organization/5/avatar.svg"></a>
204<a href="https://opencollective.com/vue-gallery/organization/6/website"><img src="https://opencollective.com/vue-gallery/organization/6/avatar.svg"></a>
205<a href="https://opencollective.com/vue-gallery/organization/7/website"><img src="https://opencollective.com/vue-gallery/organization/7/avatar.svg"></a>
206<a href="https://opencollective.com/vue-gallery/organization/8/website"><img src="https://opencollective.com/vue-gallery/organization/8/avatar.svg"></a>
207<a href="https://opencollective.com/vue-gallery/organization/9/website"><img src="https://opencollective.com/vue-gallery/organization/9/avatar.svg"></a>
208
209## License
210[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FRobinCK%2Fvue-gallery.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2FRobinCK%2Fvue-gallery?ref=badge_large)
211
212MIT © [Igor Ognichenko](https://github.com/RobinCK)