-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmagnific.php
More file actions
256 lines (249 loc) · 11.3 KB
/
magnific.php
File metadata and controls
256 lines (249 loc) · 11.3 KB
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
<!doctype html>
<html>
<head>
<title>Membuat Lightbox Popup Gallery dengan Magnific Popup & Datatables plugin bersama codekop.com </title>
<!-- BOOTSTRAP 4-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.1.3/css/bootstrap.css">
<!-- MAGNIFIC POPUP-->
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/magnific-popup.css">
<!-- DATATABLES BS 4-->
<link rel="stylesheet" href="https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css" />
<!-- jQuery -->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
<!-- DATATABLES BS 4-->
<script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<!-- BOOTSTRAP 4-->
<script src="https://cdn.datatables.net/1.10.19/js/dataTables.bootstrap4.min.js"></script>
<!-- MAGNIFIC POPUP-->
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/magnific-popup.js/1.1.0/jquery.magnific-popup.js"></script>
<style>
#portfolio {
background: #fff;
padding: 30px 0;
}
#portfolio .portfolio-overlay {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
opacity: 1;
transition: all ease-in-out 0.4s;
}
#portfolio .portfolio-item {
overflow: hidden;
position: relative;
padding: 0;
vertical-align: middle;
text-align: center;
}
#portfolio .portfolio-item h2 {
color: #ffffff;
font-size: 24px;
margin: 0;
text-transform: capitalize;
font-weight: 700;
}
#portfolio .portfolio-item img {
transition: all ease-in-out 0.4s;
width: 100%;
}
#portfolio .portfolio-item:hover img {
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
#portfolio .portfolio-item:hover .portfolio-overlay {
opacity: 1;
background: rgba(0, 0, 0, 0.7);
}
#portfolio .portfolio-info {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
#gambar{
height:100px;
}
</style>
</head>
<body>
<div class="container">
<br/>
<div class="card">
<div class="card-header bg-primary text-white">
<h4>Popup Gallery dengan Magnific Popup & Datatables plugin</h4>
</div>
<div class="card-body">
<table id="example" class="table table-striped table-bordered" style="width:100%"> <thead>
<tr>
<th>No.</th>
<th>Gambar</th>
<th>Nama Gambar</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>
<!--portfolio-->
<div id="portfolio">
<div class="portfolio-item">
<a href="img/coba/streamline.jpg" class="portfolio-popup">
<img src="img/coba/streamline.jpg" alt="your image" class="img-fluid" id="gambar">
<div class="portfolio-overlay">
<div class="portfolio-info">
<h2>Warna Merah</h2>
</div>
</div>
</a>
</div>
</div>
<!--portfolio-->
</td>
<td>
Warna Merah
</td>
</tr>
<tr>
<td>2</td>
<td>
<!--portfolio-->
<div id="portfolio">
<div class="portfolio-item">
<a href="image/yellow.jpg" class="portfolio-popup">
<img src="image/yellow.jpg" alt="your image" class="img-fluid" id="gambar">
<div class="portfolio-overlay">
<div class="portfolio-info">
<h2>Warna Kuning</h2>
</div>
</div>
</a>
</div>
</div>
<!--portfolio-->
</td>
<td>
Warna Kuning
</td>
</tr>
<tr>
<td>3</td>
<td>
<!--portfolio-->
<div id="portfolio">
<div class="portfolio-item">
<a href="image/blue.jpg" class="portfolio-popup">
<img src="image/blue.jpg" alt="your image" class="img-fluid" id="gambar">
<div class="portfolio-overlay">
<div class="portfolio-info">
<h2>Warna Biru</h2>
</div>
</div>
</a>
</div>
</div>
<!--portfolio-->
</td>
<td>
Warna Biru
</td>
</tr>
<tr>
<td>4</td>
<td>
<!--portfolio-->
<div id="portfolio">
<div class="portfolio-item">
<a href="image/green.png" class="portfolio-popup">
<img src="image/green.png" alt="your image" class="img-fluid" id="gambar">
<div class="portfolio-overlay">
<div class="portfolio-info">
<h2>Warna Hijau</h2>
</div>
</div>
</a>
</div>
</div>
<!--portfolio-->
</td>
<td>
Warna Hijau
</td>
</tr>
<tr>
<td>5</td>
<td>
<!--portfolio-->
<div id="portfolio">
<div class="portfolio-item">
<a href="image/browen.jpg" class="portfolio-popup">
<img src="image/browen.jpg" alt="your image" class="img-fluid" id="gambar">
<div class="portfolio-overlay">
<div class="portfolio-info">
<h2>Warna Coklat</h2>
</div>
</div>
</a>
</div>
</div>
<!--portfolio-->
</td>
<td>
Warna Coklat
</td>
</tr>
</tbody>
</table><!--table -->
</div><!-- card body -->
</div><!-- card -->
</div><!-- container -->
<script type="text/javascript">
// memanggil plugin magnific popup
$('.portfolio-popup').magnificPopup({
type: 'image',
removalDelay: 300,
mainClass: 'mfp-fade',
gallery: {
enabled: true
},
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out',
opener: function (openerElement) {
return openerElement.is('img') ? openerElement : openerElement.find('img');
}
}
});
// memanggil datatable membuat callback datatable pada magnific popup agar gambar
// yang di munculkan sesuai pada saat pindah paginasi dari 1 ke 2
// dan seterusnya
$(document).ready(function() {
var table = $('#example').dataTable({
"fnDrawCallback": function () {
$('.portfolio-popup').magnificPopup({
type: 'image',
removalDelay: 300,
mainClass: 'mfp-fade',
gallery: {
enabled: true
},
zoom: {
enabled: true,
duration: 300,
easing: 'ease-in-out',
opener: function (openerElement) {
return openerElement.is('img') ? openerElement : openerElement.find('img');
}
}
});
}
});
});
</script>
</body>
</html>