-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
187 lines (167 loc) · 6.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" href="https://unpkg.com/photoswipe/dist/photoswipe.css">
<!-- demo styles, ignore em-->
<style>
body {
margin: 0;
padding: 0;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
background: #eee;
}
h1 {
margin: 0;
padding: 50px 50px 30px 50px;
font-size: 26px;
line-height: 1.3;
}
.pswp-gallery img {
display: block;
max-width: 520px;
margin-bottom: 4px;
width: auto;
max-width: 100%;
}
.pswp-gallery {
max-width: 600px;
padding: 20px 50px 20px;
background: #eee;
position: relative;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.pswp-gallery a {
display: block;
}
.pswp-test {
margin-left:50px;
margin-bottom: 40px;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
align-items: flex-start;
}
.pswp-test label {
background: #fbfbfb;
padding: 4px;
border-radius: 4px;
margin-bottom: 6px;
font-size: 16px;
line-height: 1;
}
p {
padding: 4px 50px 8px;
margin: 0;
max-width: 600px;
}
</style>
</head>
<body>
<div class="main-page-content">
<h1><a href="https://github.com/dimsemenov/photoswipe-video-plugin">Video plugin</a> for the <a href="https://photoswipe.com">PhotoSwipe</a></h1>
<div class="pswp-gallery" id="gallery">
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/videos/1/video.mp4"
data-pswp-width="1920"
data-pswp-height="1080"
data-pswp-type="video"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/videos/1/thumb.jpeg" alt="" />
</a>
<a href="https://example.com/test-video-link"
data-pswp-video-src="https://cdn.photoswipe.com/photoswipe-demo-images/videos/2/video.mp4"
data-pswp-video-type="video/mp4"
data-pswp-width="1080"
data-pswp-height="2048"
data-pswp-type="video"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/videos/2/thumb.jpeg" alt="" />
</a>
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/videos/3/video.mp4"
data-pswp-width="1920"
data-pswp-height="1080"
data-pswp-type="video"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/videos/3/thumb.jpeg" alt="" />
</a>
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/1/img-2500.jpg"
data-pswp-width="1875"
data-pswp-height="2500"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/1/img-200.jpg" alt="" />
</a>
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-2500.jpg"
data-pswp-width="1669"
data-pswp-height="2500"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/2/img-200.jpg" alt="" />
</a>
<a href="https://cdn.photoswipe.com/photoswipe-demo-images/photos/3/img-2500.jpg"
data-pswp-width="2500"
data-pswp-height="1666"
target="_blank">
<img src="https://cdn.photoswipe.com/photoswipe-demo-images/photos/3/img-200.jpg" alt="" />
</a>
</div>
<div class="pswp-test">
<label for="autoplay_video">
<input type="checkbox" id="autoplay_video" name="autoplay_video">Autoplay video
</label>
<label for="play_inline">
<input type="checkbox" id="play_inline" name="play_inline">Play inline
</label>
<label for="prevent_dragging_over_video">
<input type="checkbox" id="prevent_dragging_over_video" name="prevent_dragging_over_video">Prevent dragging over video
</label>
</div>
<script>
/* debug stuff */
window.pswpTempTestVars = {
autoplay_video: true,
play_inline: true,
prevent_dragging_over_video: false
};
for(let key in window.pswpTempTestVars) {
document.querySelector('#' + key).checked = window.pswpTempTestVars[key];
}
[...document.querySelectorAll('.pswp-test input')].forEach((checkbox) => {
checkbox.addEventListener('change', (e) => {
if (e.currentTarget.checked) {
window.pswpTempTestVars[e.currentTarget.name] = true;
} else {
window.pswpTempTestVars[e.currentTarget.name] = false;
}
});
});
</script>
<script type="module">
import PhotoSwipeLightbox from 'https://unpkg.com/photoswipe/dist/photoswipe-lightbox.esm.js';
import PhotoSwipeVideoPlugin from './src/index.js';
const lightbox = new PhotoSwipeLightbox({
gallery: '#gallery',
children: 'a',
pswpModule: () => import('https://unpkg.com/photoswipe/dist/photoswipe.esm.js'),
padding: {
top: 50,
bottom: 50,
left: 0,
right: 0
},
// Recommended PhotoSwipe options for this plugin
allowPanToNext: false, // prevent swiping to the next slide when image is zoomed
allowMouseDrag: true, // display dragging cursor at max zoom level
wheelToZoom: true, // enable wheel-based zoom
zoom: false // disable default zoom button
});
const videoPlugin = new PhotoSwipeVideoPlugin(lightbox, {
});
lightbox.init();
</script>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. </p>
</div>
</body>
</html>