…
<?php
$this->addJS('templates/' . $this->name . '/controllers/content/widgets/swiper/js/script.js');
$this->addCSS('templates/' . $this->name . '/controllers/content/widgets/swiper/css/style.css');
?>
<div class="swiper-container">
<div class="swiper-wrapper">
<?php foreach ($items as $item) { ?>
<?php
$image = $item[(!empty($big_image_field) ?
$big_image_field : $image_field)]; ?>
<div class="swiper-slide">
<img src="<?php echo html_image_src($image, "content_list", true); ?>" class="swiper-lazy">
<div class="swiper-lazy-preloader"></div>
</div>
<?php } ?>
</div>
<div class="swiper-pagination"></div>
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<script>
var swiper = new Swiper('.swiper-container', {
slidesPerView: 6, // кол-во слайдов на экране
spaceBetween: 30,
autoplay: true,
loop: true,
lazy: false, // включаем отложенную загрузку изображений
pagination: {
el: '.swiper-pagination',
clickable: true,
}
,
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
}
});
</script>