File tree Expand file tree Collapse file tree 3 files changed +54
-1
lines changed
Expand file tree Collapse file tree 3 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 1717 </svg >
1818 </div >
1919 <div class =" lightbox__image" @click.stop =" " >
20- <img :src =" images[index]" >
20+ <slot name =" loader" v-if =" $slots.loader" ></slot >
21+ <img :src =" images[index]" @load =" loaded" v-if =" displayImage" >
2122 </div >
2223 <div
2324 class =" lightbox__arrow lightbox__arrow--right"
3536</template >
3637
3738<script >
39+ import Vue from ' vue'
40+
3841 export default {
3942 props: [
4043 ' thumbnail' ,
4548 return {
4649 visible: false ,
4750 index: 0 ,
51+ displayImage: true ,
4852 }
4953 },
5054 mounted () {
7175 prev () {
7276 if (this .has_prev ()) {
7377 this .index -= 1
78+ this .tick ()
7479 }
7580 },
7681 next () {
7782 if (this .has_next ()) {
7883 this .index += 1
84+ this .tick ()
7985 }
8086 },
87+ tick () {
88+ this .displayImage = false
89+
90+ Vue .nextTick (() => {
91+ this .displayImage = true
92+ })
93+ },
8194 eventListener (e ) {
8295 if (this .visible ) {
8396 switch (e .key ) {
163176 .lightbox__image {
164177 flex : 1 ;
165178 }
179+
166180 .lightbox__image img {
167181 width : 100% ;
168182 height : auto !important ;
Original file line number Diff line number Diff line change 1+ <template >
2+ <div class =" lightbox__default-loader" >
3+ <div class =" lightbox__default-loader__element" ></div >
4+ </div >
5+ </template >
6+
7+ <script >
8+ export default {
9+ //
10+ }
11+ </script >
12+
13+ <style >
14+ .lightbox__default-loader {
15+ position : absolute ;
16+ top : 50% ;
17+ left : 50% ;
18+ transform : translate (-50% , -50% );
19+ z-index : -1 ;
20+ }
21+
22+ .lightbox__default-loader__element {
23+ animation : LightboxDefaultLoaderAnimation 1s linear infinite ;
24+ border : 3px solid #292929 ;
25+ border-top : 3px solid #fff ;
26+ border-radius : 50% ;
27+ height : 75px ;
28+ width : 75px ;
29+ }
30+
31+ @keyframes LightboxDefaultLoaderAnimation {
32+ to {
33+ border-top-color : #fff ;
34+ transform : rotate (360deg );
35+ }
36+ }
37+ </style >
Original file line number Diff line number Diff line change 11import LightboxComponent from './Components/Lightbox.vue'
2+ import LightboxDefaultLoader from './Components/LightboxDefaultLoader.vue'
23
34const Lightbox = {
45 install ( Vue , options = { } ) {
56 Vue . mixin ( {
67 components : {
78 lightbox : LightboxComponent ,
9+ LightboxDefaultLoader,
810 } ,
911 } ) ;
1012 } ,
You can’t perform that action at this time.
0 commit comments