File tree 2 files changed +11
-9
lines changed
2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change 13
13
< div class ="gallery ">
14
14
< div class ="img-container ">
15
15
< img
16
- src ="https://source .unsplash.com/tzSLATuyZzM/640x853 "
16
+ src ="https://images .unsplash.com/photo-1690790427878-ecf29d8b686b?q=80&w=640 "
17
17
alt ="No elegance is possible without perfume "
18
- data-original ="tzSLATuyZzM/1920x2560 "
18
+ data-original ="1887 "
19
19
/>
20
20
</ div >
21
21
< div class ="img-container ">
22
22
< img
23
- src ="https://source .unsplash.com/GWQ2KmCXrQA/640x1137 "
23
+ src ="https://images .unsplash.com/photo-1696218614256-b74c0bcde0d5?q=80&w=640 "
24
24
alt ="It is the unseen, unforgettable, ultimate accessory "
25
- data-original ="GWQ2KmCXrQA/1920x3413 "
25
+ data-original ="1887 "
26
26
/>
27
27
</ div >
28
28
< div class ="img-container ">
29
29
< img
30
- src ="https://source .unsplash.com/nkWnc-W_GP8/640x853 "
30
+ src ="https://images .unsplash.com/photo-1696218359361-b088f32f86b8?q=80&w=640 "
31
31
alt ="A perfume is like a piece of clothing, a message "
32
- data-original ="nkWnc-W_GP8/1920x2560 "
32
+ data-original ="1887 "
33
33
/>
34
34
</ div >
35
35
< div class ="img-container ">
36
36
< img
37
- src ="https://source .unsplash.com/Ou00pmFFPKA/640x853 "
37
+ src ="https://images .unsplash.com/photo-1690790591188-3503c1a4dcb6?q=80&w=640 "
38
38
alt ="Perfume is like a parenthesis, a moment of freedom "
39
- data-original ="Ou00pmFFPKA/1920x2560 "
39
+ data-original ="1887 "
40
40
/>
41
41
</ div >
42
42
</ div >
Original file line number Diff line number Diff line change @@ -7,8 +7,10 @@ previews.forEach((preview) => {
7
7
preview . addEventListener ( "click" , ( ) => {
8
8
modal . classList . add ( "open" ) ;
9
9
original . classList . add ( "open" ) ;
10
+ const originalUrl = new URL ( preview . src ) ;
10
11
const originalSize = preview . getAttribute ( "data-original" ) ;
11
- original . src = `https://source.unsplash.com/${ originalSize } ` ;
12
+ originalUrl . searchParams . set ( "w" , originalSize ) ;
13
+ original . src = originalUrl . toString ( ) ;
12
14
caption . textContent = preview . alt ;
13
15
// Reference: https://stackoverflow.com/questions/35213147/difference-between-textcontent-vs-innertext
14
16
} ) ;
You can’t perform that action at this time.
0 commit comments