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 17
17
</svg >
18
18
</div >
19
19
<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" >
21
22
</div >
22
23
<div
23
24
class =" lightbox__arrow lightbox__arrow--right"
35
36
</template >
36
37
37
38
<script >
39
+ import Vue from ' vue'
40
+
38
41
export default {
39
42
props: [
40
43
' thumbnail' ,
45
48
return {
46
49
visible: false ,
47
50
index: 0 ,
51
+ displayImage: true ,
48
52
}
49
53
},
50
54
mounted () {
71
75
prev () {
72
76
if (this .has_prev ()) {
73
77
this .index -= 1
78
+ this .tick ()
74
79
}
75
80
},
76
81
next () {
77
82
if (this .has_next ()) {
78
83
this .index += 1
84
+ this .tick ()
79
85
}
80
86
},
87
+ tick () {
88
+ this .displayImage = false
89
+
90
+ Vue .nextTick (() => {
91
+ this .displayImage = true
92
+ })
93
+ },
81
94
eventListener (e ) {
82
95
if (this .visible ) {
83
96
switch (e .key ) {
163
176
.lightbox__image {
164
177
flex : 1 ;
165
178
}
179
+
166
180
.lightbox__image img {
167
181
width : 100% ;
168
182
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 1
1
import LightboxComponent from './Components/Lightbox.vue'
2
+ import LightboxDefaultLoader from './Components/LightboxDefaultLoader.vue'
2
3
3
4
const Lightbox = {
4
5
install ( Vue , options = { } ) {
5
6
Vue . mixin ( {
6
7
components : {
7
8
lightbox : LightboxComponent ,
9
+ LightboxDefaultLoader,
8
10
} ,
9
11
} ) ;
10
12
} ,
You can’t perform that action at this time.
0 commit comments