2021-05-31 20:28:57 +02:00
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
<?php
|
|
|
|
$this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel'));
|
|
|
|
$this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel'));
|
|
|
|
$caret = sprintf('<img class="caret" id="left" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
|
|
|
|
$caret_r = sprintf('<img class="caret" id="right" src="%s">', $this->assetUrl('caret.png', 'SimpleCarousel'));
|
|
|
|
?>
|
|
|
|
|
|
|
|
<style>
|
2021-09-08 09:32:58 +02:00
|
|
|
/* styles placed in carousel.css */
|
2021-06-27 15:51:36 +02:00
|
|
|
</style>
|
2021-05-31 20:28:57 +02:00
|
|
|
|
2021-09-06 19:29:26 +02:00
|
|
|
<div class="archive-item-block archive-carousel">
|
2021-05-31 20:28:57 +02:00
|
|
|
|
|
|
|
<?php if ($renderSourceLink) { ?>
|
|
|
|
<div class="source-link">
|
2021-06-28 15:48:32 +02:00
|
|
|
<a href="">Source</a>
|
2021-05-31 20:28:57 +02:00
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
|
2021-09-08 09:32:58 +02:00
|
|
|
<div class="archive-carousel-container">
|
|
|
|
<div class="siema_<?php $carousel_id ?> siema">
|
2021-06-28 15:48:32 +02:00
|
|
|
<?php foreach ($images as $image) { ?>
|
2021-09-08 09:32:58 +02:00
|
|
|
<div class="siema-wrap" style="<?php // $wrapStyle ?>"
|
2021-06-27 15:51:36 +02:00
|
|
|
>
|
|
|
|
<img class="siema-img"
|
2021-09-08 09:32:58 +02:00
|
|
|
style="<?php $imgStyle ?>"
|
|
|
|
src="<?php $image['media_url'] ?>"
|
2021-06-27 15:51:36 +02:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
<?php } ?>
|
|
|
|
</div>
|
|
|
|
<div id="siema-ui"></div>
|
2021-05-31 20:28:57 +02:00
|
|
|
</div>
|
2021-06-28 16:37:38 +02:00
|
|
|
|
|
|
|
<?php if ($title) { ?>
|
|
|
|
<div class="item_title">
|
2021-09-08 09:32:58 +02:00
|
|
|
<?php $title ?>
|
2021-06-28 16:37:38 +02:00
|
|
|
</div>
|
2021-06-27 15:51:36 +02:00
|
|
|
<?php } ?>
|
2021-05-31 20:28:57 +02:00
|
|
|
</div>
|
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
<script>
|
2021-06-28 15:48:32 +02:00
|
|
|
|
|
|
|
var sourceURLs = [];
|
|
|
|
<?php foreach ($images as $image) { ?>
|
2021-09-08 09:32:58 +02:00
|
|
|
sourceURLs.push("<?php $image['item_url'] ?>")
|
2021-06-28 15:48:32 +02:00
|
|
|
<?php } ?>
|
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
$(document).ready(function() {
|
|
|
|
let siema = new Siema({
|
2021-09-08 09:32:58 +02:00
|
|
|
selector: '.siema_<?php $carousel_id ?>',
|
2021-06-27 15:51:36 +02:00
|
|
|
easing: 'ease-out',
|
|
|
|
duration: <?php echo $duration ?>,
|
|
|
|
perPage: <?php echo $perPage ?>,
|
|
|
|
loop: <?php echo $loop ?>,
|
2021-06-28 15:48:32 +02:00
|
|
|
draggable: <?php echo $draggable ?>,
|
|
|
|
onInit: changeSourceURL,
|
|
|
|
onChange: changeSourceURL,
|
2021-06-27 15:51:36 +02:00
|
|
|
});
|
2021-05-31 20:28:57 +02:00
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
let caret = '<?php echo $caret;?>';
|
|
|
|
let caret_r = '<?php echo $caret_r;?>';
|
2021-05-31 20:28:57 +02:00
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
$('#siema-ui').append(caret);
|
|
|
|
$('#siema-ui').append(caret_r);
|
2021-05-31 20:28:57 +02:00
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
$('.caret#left').click(function () {siema.prev()});
|
|
|
|
$('.caret#right').click(function () {siema.next()});
|
2021-05-31 20:28:57 +02:00
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
<?php if ($autoSlide == true): ?>
|
|
|
|
window.setInterval(() => {
|
|
|
|
siema.next();
|
|
|
|
}, <?php echo $autoSlideInt; ?>);
|
|
|
|
<?php endif ?>
|
|
|
|
});
|
2021-06-28 15:48:32 +02:00
|
|
|
|
|
|
|
function changeSourceURL(){
|
|
|
|
var slide_idx = this.currentSlide
|
|
|
|
if (slide_idx < 0) {
|
|
|
|
slide_idx = sourceURLs.length -1;
|
|
|
|
}
|
2021-09-08 09:32:58 +02:00
|
|
|
var source_link = $(".siema_<?php $carousel_id ?>")
|
2021-06-28 15:48:32 +02:00
|
|
|
.closest(".archive-carousel")
|
|
|
|
.find(".source-link")
|
|
|
|
.find('a');
|
|
|
|
if (source_link.length != 0) {
|
|
|
|
$(source_link).attr("href", sourceURLs[slide_idx])
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2021-06-27 15:51:36 +02:00
|
|
|
</script>
|