vue-gallery
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -7,4 +7,2 @@ (function (global, factory) { | ||
blueimp = blueimp && blueimp.hasOwnProperty('default') ? blueimp['default'] : blueimp; | ||
// | ||
@@ -284,3 +282,3 @@ var script = { | ||
if (!inject) return | ||
inject("data-v-6d2033ba_0", { source: ".blueimp-gallery>.description{position:absolute;top:30px;left:15px;color:#fff;display:none}.blueimp-gallery-controls>.description{display:block}", map: undefined, media: undefined }); | ||
inject("data-v-6d767caf_0", { source: ".blueimp-gallery>.description{position:absolute;top:30px;left:15px;color:#fff;display:none}.blueimp-gallery-controls>.description{display:block}", map: undefined, media: undefined }); | ||
@@ -287,0 +285,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("blueimp-gallery/css/blueimp-gallery.min.css"),require("blueimp-gallery/js/blueimp-gallery-fullscreen.js"),require("blueimp-gallery/js/blueimp-gallery-video.js"),require("blueimp-gallery/js/blueimp-gallery-youtube.js"),require("blueimp-gallery/js/blueimp-gallery.js")):"function"==typeof define&&define.amd?define(["blueimp-gallery/css/blueimp-gallery.min.css","blueimp-gallery/js/blueimp-gallery-fullscreen.js","blueimp-gallery/js/blueimp-gallery-video.js","blueimp-gallery/js/blueimp-gallery-youtube.js","blueimp-gallery/js/blueimp-gallery.js"],t):(e=e||self).VueGallery=t(null,null,null,null,e.blueimp)}(this,function(e,t,n,i,s){"use strict";s=s&&s.hasOwnProperty("default")?s.default:s;var l={props:{images:{type:Array,default:function(){return[]}},options:{type:Object,default:function(){return{}}},carousel:{type:Boolean,default:!1},index:{type:Number},id:{type:String,default:"blueimp-gallery"}},data:function(){return{instance:null}},watch:{index:function(e){this.carousel||(null!==e?this.open(e):(this.instance&&this.instance.close(),this.$emit("close")))}},mounted:function(){this.carousel&&this.open()},destroyed:function(){null!==this.instance&&(this.instance.destroyEventListeners(),this.instance.close(),this.instance=null)},methods:{open:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=void 0!==s.Gallery?s.Gallery:s,i=Object.assign({toggleControlsOnReturn:!1,toggleControlsOnSlideClick:!1,closeOnSlideClick:!1,carousel:this.carousel,container:"#".concat(this.id),index:t,onopen:function(){return e.$emit("onopen")},onopened:function(){return e.$emit("onopened")},onslide:this.onSlideCustom,onslideend:function(t,n){return e.$emit("onslideend",{index:t,slide:n})},onslidecomplete:function(t,n){return e.$emit("onslidecomplete",{index:t,slide:n})},onclose:function(){return e.$emit("close")},onclosed:function(){return e.$emit("onclosed")}},this.options);this.carousel&&(i.container=this.$el),this.instance=n(this.images,i)},onSlideCustom:function(e,t){this.$emit("onslide",{index:e,slide:t});var n=this.images[e];if(void 0!==n){var i=n.description,s=this.instance.container.find(".description");i&&(s.empty(),s[0].appendChild(document.createTextNode(i)))}}}};var o=function(e,t,n,i,s,l,o,r,a,u){"boolean"!=typeof o&&(a=r,r=o,o=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),l?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(l)},d._ssrRegister=c):t&&(c=o?function(){t.call(this,u(this.$root.$options.shadowRoot))}:function(e){t.call(this,r(e))}),c)if(d.functional){var p=d.render;d.render=function(e,t){return c.call(t),p(e,t)}}else{var m=d.beforeCreate;d.beforeCreate=m?[].concat(m,c):[c]}return n},r="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var a=document.head||document.getElementsByTagName("head")[0],u={};return o({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"blueimp-gallery blueimp-gallery-controls",class:{"blueimp-gallery-carousel":e.carousel},attrs:{id:e.id}},[n("div",{staticClass:"slides"}),e._v(" "),n("h3",{staticClass:"title"}),e._v(" "),n("p",{staticClass:"description"}),e._v(" "),n("a",{staticClass:"prev"},[e._t("prev",[e._v("‹")])],2),e._v(" "),n("a",{staticClass:"next"},[e._t("next",[e._v("›")])],2),e._v(" "),e.carousel?e._e():n("a",{staticClass:"close"},[e._t("close",[e._v("×")])],2),e._v(" "),e.carousel?e._e():n("ol",{staticClass:"indicator"}),e._v(" "),e.carousel?n("a",{staticClass:"play-pause"}):e._e()])},staticRenderFns:[]},function(e){e&&e("data-v-6d2033ba_0",{source:".blueimp-gallery>.description{position:absolute;top:30px;left:15px;color:#fff;display:none}.blueimp-gallery-controls>.description{display:block}",map:void 0,media:void 0})},l,void 0,!1,void 0,function(e){return function(e,t){return function(e,t){var n=r?t.media||"default":e,i=u[n]||(u[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var s=t.source;if(t.map&&(s+="\n/*# sourceURL="+t.map.sources[0]+" */",s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",t.media&&i.element.setAttribute("media",t.media),a.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(s),i.element.styleSheet.cssText=i.styles.filter(Boolean).join("\n");else{var l=i.ids.size-1,o=document.createTextNode(s),c=i.element.childNodes;c[l]&&i.element.removeChild(c[l]),c.length?i.element.insertBefore(o,c[l]):i.element.appendChild(o)}}}(e,t)}},void 0)}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("blueimp-gallery/css/blueimp-gallery.min.css"),require("blueimp-gallery/js/blueimp-gallery-fullscreen.js"),require("blueimp-gallery/js/blueimp-gallery-video.js"),require("blueimp-gallery/js/blueimp-gallery-youtube.js"),require("blueimp-gallery/js/blueimp-gallery.js")):"function"==typeof define&&define.amd?define(["blueimp-gallery/css/blueimp-gallery.min.css","blueimp-gallery/js/blueimp-gallery-fullscreen.js","blueimp-gallery/js/blueimp-gallery-video.js","blueimp-gallery/js/blueimp-gallery-youtube.js","blueimp-gallery/js/blueimp-gallery.js"],t):(e=e||self).VueGallery=t(null,null,null,null,e.blueimp)}(this,function(e,t,n,i,s){"use strict";var l={props:{images:{type:Array,default:function(){return[]}},options:{type:Object,default:function(){return{}}},carousel:{type:Boolean,default:!1},index:{type:Number},id:{type:String,default:"blueimp-gallery"}},data:function(){return{instance:null}},watch:{index:function(e){this.carousel||(null!==e?this.open(e):(this.instance&&this.instance.close(),this.$emit("close")))}},mounted:function(){this.carousel&&this.open()},destroyed:function(){null!==this.instance&&(this.instance.destroyEventListeners(),this.instance.close(),this.instance=null)},methods:{open:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=void 0!==s.Gallery?s.Gallery:s,i=Object.assign({toggleControlsOnReturn:!1,toggleControlsOnSlideClick:!1,closeOnSlideClick:!1,carousel:this.carousel,container:"#".concat(this.id),index:t,onopen:function(){return e.$emit("onopen")},onopened:function(){return e.$emit("onopened")},onslide:this.onSlideCustom,onslideend:function(t,n){return e.$emit("onslideend",{index:t,slide:n})},onslidecomplete:function(t,n){return e.$emit("onslidecomplete",{index:t,slide:n})},onclose:function(){return e.$emit("close")},onclosed:function(){return e.$emit("onclosed")}},this.options);this.carousel&&(i.container=this.$el),this.instance=n(this.images,i)},onSlideCustom:function(e,t){this.$emit("onslide",{index:e,slide:t});var n=this.images[e];if(void 0!==n){var i=n.description,s=this.instance.container.find(".description");i&&(s.empty(),s[0].appendChild(document.createTextNode(i)))}}}};var o=function(e,t,n,i,s,l,o,r,a,u){"boolean"!=typeof o&&(a=r,r=o,o=!1);var c,d="function"==typeof n?n.options:n;if(e&&e.render&&(d.render=e.render,d.staticRenderFns=e.staticRenderFns,d._compiled=!0,s&&(d.functional=!0)),i&&(d._scopeId=i),l?(c=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(l)},d._ssrRegister=c):t&&(c=o?function(){t.call(this,u(this.$root.$options.shadowRoot))}:function(e){t.call(this,r(e))}),c)if(d.functional){var p=d.render;d.render=function(e,t){return c.call(t),p(e,t)}}else{var m=d.beforeCreate;d.beforeCreate=m?[].concat(m,c):[c]}return n},r="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());var a=document.head||document.getElementsByTagName("head")[0],u={};return o({render:function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"blueimp-gallery blueimp-gallery-controls",class:{"blueimp-gallery-carousel":e.carousel},attrs:{id:e.id}},[n("div",{staticClass:"slides"}),e._v(" "),n("h3",{staticClass:"title"}),e._v(" "),n("p",{staticClass:"description"}),e._v(" "),n("a",{staticClass:"prev"},[e._t("prev",[e._v("‹")])],2),e._v(" "),n("a",{staticClass:"next"},[e._t("next",[e._v("›")])],2),e._v(" "),e.carousel?e._e():n("a",{staticClass:"close"},[e._t("close",[e._v("×")])],2),e._v(" "),e.carousel?e._e():n("ol",{staticClass:"indicator"}),e._v(" "),e.carousel?n("a",{staticClass:"play-pause"}):e._e()])},staticRenderFns:[]},function(e){e&&e("data-v-6d767caf_0",{source:".blueimp-gallery>.description{position:absolute;top:30px;left:15px;color:#fff;display:none}.blueimp-gallery-controls>.description{display:block}",map:void 0,media:void 0})},l,void 0,!1,void 0,function(e){return function(e,t){return function(e,t){var n=r?t.media||"default":e,i=u[n]||(u[n]={ids:new Set,styles:[]});if(!i.ids.has(e)){i.ids.add(e);var s=t.source;if(t.map&&(s+="\n/*# sourceURL="+t.map.sources[0]+" */",s+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(t.map))))+" */"),i.element||(i.element=document.createElement("style"),i.element.type="text/css",t.media&&i.element.setAttribute("media",t.media),a.appendChild(i.element)),"styleSheet"in i.element)i.styles.push(s),i.element.styleSheet.cssText=i.styles.filter(Boolean).join("\n");else{var l=i.ids.size-1,o=document.createTextNode(s),c=i.element.childNodes;c[l]&&i.element.removeChild(c[l]),c.length?i.element.insertBefore(o,c[l]):i.element.appendChild(o)}}}(e,t)}},void 0)}); |
{ | ||
"name": "vue-gallery", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "VueJS responsive and customizable image and video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers.", | ||
@@ -5,0 +5,0 @@ "main": "dist/js/vue-gallery.js", |
@@ -35,6 +35,7 @@ <p align="center"> | ||
#### NPM | ||
#### npm | ||
``` bash | ||
npm install vue-gallery --save | ||
npm install vue-gallery | ||
``` | ||
@@ -46,12 +47,25 @@ | ||
yarn add vue-gallery | ||
``` | ||
## Development Setup | ||
``` bash | ||
# install dependencies | ||
npm install | ||
### Nuxt | ||
# build dist files | ||
npm run build | ||
1. Add a new file named `vue-gallery.client.js` to your nuxt plugins folder. It is important that your filename ends in `.client.js` ([more info on this convention](https://nuxtjs.org/guide/plugins/#name-conventional-plugin), only works from Nuxt v.2.4.0). | ||
2. Copy paste the following content in it: | ||
```js | ||
import Vue from 'vue' | ||
import VueGallery from 'vue-gallery' | ||
Vue.component('VGallery', VueGallery) | ||
``` | ||
3. Add it to your list of plugins in `nuxt.config.js`: | ||
```js | ||
plugins: ['~plugins/vue-gallery.client.js'] | ||
``` | ||
4. You can now use the component globally: | ||
```js | ||
<v-gallery :images="images" | ||
:index="index" | ||
@close="index = null" /> | ||
``` | ||
@@ -174,2 +188,45 @@ ## Usage | ||
## Known Issues | ||
### 1. Multiple VueGallery components in same page breaks functionalities | ||
**Fix:** Give each gallery a unique id. [jsFiddle Example](https://jsfiddle.net/sam_saama/nzjp13ec/) | ||
### 2. Images not oriented correctly. | ||
It's because the image isn't in the "correct" orientation and the exif orientation data is what "fixes" the orientation when you view the images. Browsers don't fix the image orientation based on the exif data. Some browsers show it "correctly" when you open the image in a new tab by itself but don't fix it if you use the image link in a src attribute. [Relevant stackoverflow](https://stackoverflow.com/questions/24658365/img-tag-displays-wrong-orientation). | ||
**Fix:** Use the `onslide` callback to read the exif data and "correct" the orientation based of the exif orientation. [More info on blueimp-gallery](https://github.com/blueimp/Gallery#event-callbacks). | ||
[jsFiddle Example](https://jsfiddle.net/sam_saama/72k0xr3n/) | ||
Code excerpt: | ||
```html | ||
<gallery :options="options" :images="images" :index="index" @close="index = null"/> | ||
``` | ||
```js | ||
data() { | ||
//... | ||
options: { | ||
onslide: function(index, slide) { | ||
const rotation = { | ||
1: 'rotate(0deg)', | ||
3: 'rotate(180deg)', | ||
6: 'rotate(90deg)', | ||
8: 'rotate(270deg)' | ||
} | ||
//Conditionally change rotation of image based on the image orientation data. Example jsfiddle --> https://jsfiddle.net/orotemo/obvna6qn/ Or use something like https://github.com/mattiasw/ExifReader | ||
//But for this example, the fix has been hardcoded. | ||
slide.getElementsByTagName( | ||
'img' | ||
)[0].style = `transform: ${rotation['3']};` | ||
} | ||
} | ||
} | ||
``` | ||
## Other my Vue JS plugins | ||
@@ -182,2 +239,13 @@ | ||
## Development Setup | ||
``` bash | ||
# install dependencies | ||
npm install | ||
# build dist files | ||
npm run build | ||
``` | ||
## Contributors | ||
@@ -184,0 +252,0 @@ |
Sorry, the diff of this file is not supported yet
32952
281
8
286