2021-06-28 12:07:44 +02:00
|
|
|
|
|
|
|
<?php
|
|
|
|
$this->headLink()->appendStylesheet($this->assetUrl('css/gallery.css', 'ImageGallery'));
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php $image_id = 0; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="archive-gallery">
|
2021-07-10 21:11:41 +02:00
|
|
|
<div class="source-link">
|
2021-07-10 22:19:48 +02:00
|
|
|
<a href="">Source</a>
|
2021-07-10 21:11:41 +02:00
|
|
|
</div>
|
2021-06-28 12:07:44 +02:00
|
|
|
|
|
|
|
<section id="<?= $gallery_id ?>"
|
2021-06-28 13:05:17 +02:00
|
|
|
class="gallery"
|
|
|
|
style="padding-top: 400px; max-width: <?= $max_width ?>%;">
|
2021-06-28 12:07:44 +02:00
|
|
|
|
|
|
|
<?php foreach ($images as $image) { ?>
|
|
|
|
<?php $image_id = $image_id +1;
|
|
|
|
$img_id = $gallery_id . '-' . $image_id;
|
|
|
|
?>
|
|
|
|
<div class="gallery__item">
|
|
|
|
<input type="radio"
|
|
|
|
id="<?= $img_id ?>"
|
|
|
|
checked name="gallery"
|
|
|
|
class="gallery__selector"/>
|
|
|
|
<img class="gallery__img"
|
2021-06-28 13:05:17 +02:00
|
|
|
style=""
|
2021-07-10 21:11:41 +02:00
|
|
|
src="<?= $image['media_url'] ?>"
|
2021-07-10 22:19:48 +02:00
|
|
|
item_url="<?= $image['item_url'] ?>"
|
|
|
|
alt=""
|
2021-06-28 12:07:44 +02:00
|
|
|
/>
|
|
|
|
<label for="<?= $img_id ?>" class="gallery__thumb">
|
2021-07-10 21:11:41 +02:00
|
|
|
<img src="<?= $image['media_url'] ?>"
|
2021-07-10 22:19:48 +02:00
|
|
|
alt=""
|
2021-07-10 21:11:41 +02:00
|
|
|
item_url="<?= $image['item_url'] ?>"
|
|
|
|
onclick="updateSourceURL(this)"
|
2021-06-28 12:07:44 +02:00
|
|
|
/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php } ?>
|
|
|
|
|
|
|
|
</section>
|
2021-06-28 13:44:49 +02:00
|
|
|
|
|
|
|
<?php if ($title) { ?>
|
|
|
|
<div class="item_title">
|
|
|
|
<?= $title ?>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
|
2021-06-28 12:07:44 +02:00
|
|
|
</div>
|
2021-06-28 13:05:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-07-10 21:11:41 +02:00
|
|
|
|
|
|
|
function updateSourceURL(thumbnail){
|
|
|
|
$(thumbnail).closest(".archive-gallery")
|
|
|
|
.find('.source-link')
|
|
|
|
.find('a').prop('href', $(thumbnail).attr('item_url'));
|
|
|
|
}
|
|
|
|
jQuery(document).ready(function() {
|
|
|
|
$('.archive-gallery').each(function(i, el){
|
2021-07-10 22:19:48 +02:00
|
|
|
var first_thumbnail = $(el).find('.gallery__img:first')
|
|
|
|
updateSourceURL(first_thumbnail)
|
2021-07-10 21:11:41 +02:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2021-06-28 13:05:17 +02:00
|
|
|
jQuery(document).ready(function() {
|
|
|
|
var gallery_image_height=0;
|
|
|
|
$( ".gallery__img" ).each(function( index ) {
|
|
|
|
if ($(this).height() > gallery_image_height) {
|
|
|
|
gallery_image_height = $(this).height();
|
|
|
|
}
|
|
|
|
});
|
2021-07-10 22:19:48 +02:00
|
|
|
$( ".gallery__img" ).each(function( index ) {
|
|
|
|
$(this).css('height', gallery_image_height)
|
|
|
|
});
|
2021-06-28 13:05:17 +02:00
|
|
|
$('section.gallery').css('padding-top', gallery_image_height)
|
|
|
|
});
|
2021-07-10 22:19:48 +02:00
|
|
|
|
2021-06-28 13:05:17 +02:00
|
|
|
</script>
|