SimpleCarousel-omeka-module/view/common/block-layout/simple-carousel.phtml

74 lines
1.9 KiB
PHTML

<div style="position:relative;">
<?php
$this->headLink()->appendStylesheet($this->assetUrl('css/carousel.css', 'SimpleCarousel'));
$this->headScript()->appendFile($this->assetUrl('js/siema.min.js', 'SimpleCarousel'));
$title = false;
$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'));
?>
<div class="archive-carousel">
<?php if ($renderSourceLink) { ?>
<div class="source-link">
<a href="<?= $item_url ?>">Source</a>
</div>
<?php } ?>
<div class="siema">
<?php
foreach ($urls as $url) {
$html = sprintf('<div class="siema-wrap" style="%s"><img class="siema-img" style="%s" src="%s"></div>', $wrapStyle, $imgStyle, $url);
echo $html;
}
?>
</div>
<div id="siema-ui"></div>
</div>
<?php if ($subTitle) { ?>
<div class="item_title">
<?= $subTitle ?>
</div>
<?php } ?>
<style>
.siema-wrap { height: <?php echo $height ?>; }
.siema-img { width: 100%; }
#siema-ui { background-color: <?php echo $ui_background ?>; }
</style>
<script>
$(document).ready(function() {
let siema = new Siema({
selector: '.siema',
easing: 'ease-out',
duration: <?php echo $duration ?>,
perPage: <?php echo $perPage ?>,
loop: <?php echo $loop ?>,
draggable: <?php echo $draggable ?>
});
let caret = '<?php echo $caret;?>';
let caret_r = '<?php echo $caret_r;?>';
$('#siema-ui').append(caret);
<?php if ($title !== false): ?>
$('#siema-ui').append('<?php echo $title;?>');
<?php endif ?>
$('#siema-ui').append(caret_r);
$('.caret#left').click(function () {siema.prev()});
$('.caret#right').click(function () {siema.next()});
<?php if ($autoSlide == true): ?>
window.setInterval(() => {
siema.next();
}, <?php echo $autoSlideInt; ?>);
<?php endif ?>
});
</script>
</div>