Browse code

Update

Benjamin Roth authored on24/03/2023 16:12:06
Showing1 changed files
... ...
@@ -8,7 +8,7 @@
8 8
 
9 9
 
10 10
 <?php if (!empty($this->products)) : ?>
11
-    <div class="product-slider--wrapper mt-3">
11
+    <div class="product-slider--wrapper position-relative mt-3">
12 12
         <div class="swiper product-slider product-slider_<?= $this->id; ?>">
13 13
             <div class="swiper-wrapper">
14 14
                 <!-- Slides -->
... ...
@@ -17,21 +17,6 @@
17 17
                         <?php echo $product['html']; ?>
18 18
                     </div>
19 19
                 <?php endforeach; ?>
20
-                <?php foreach ($this->products as $product) : ?>
21
-                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
22
-                        <?php echo $product['html']; ?>
23
-                    </div>
24
-                <?php endforeach; ?>
25
-                <?php foreach ($this->products as $product) : ?>
26
-                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
27
-                        <?php echo $product['html']; ?>
28
-                    </div>
29
-                <?php endforeach; ?>
30
-                <?php foreach ($this->products as $product) : ?>
31
-                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
32
-                        <?php echo $product['html']; ?>
33
-                    </div>
34
-                <?php endforeach; ?>
35 20
             </div>
36 21
         </div>
37 22
         <div class="product-slider_<?= $this->id; ?> swiper-button-prev"></div>
... ...
@@ -51,7 +36,7 @@
51 36
                     },
52 37
 
53 38
                     direction: 'horizontal',
54
-                    loop: true,
39
+                    loop: false,
55 40
                     preloadImages: true,
56 41
                     slidesPerView: 1,
57 42
                     breakpoints: {
Browse code

Initial commit

Benjamin Roth authored on16/03/2023 20:22:35
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,79 @@
1
+<?php $this->extend('block_searchable'); ?>
2
+
3
+<?php $this->block('content'); ?>
4
+
5
+<?php if ($this->message) : ?>
6
+    <p class="alert <?php echo $this->type; ?> message"><?php echo $this->message; ?></p>
7
+<?php endif; ?>
8
+
9
+
10
+<?php if (!empty($this->products)) : ?>
11
+    <div class="product-slider--wrapper mt-3">
12
+        <div class="swiper product-slider product-slider_<?= $this->id; ?>">
13
+            <div class="swiper-wrapper">
14
+                <!-- Slides -->
15
+                <?php foreach ($this->products as $product) : ?>
16
+                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
17
+                        <?php echo $product['html']; ?>
18
+                    </div>
19
+                <?php endforeach; ?>
20
+                <?php foreach ($this->products as $product) : ?>
21
+                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
22
+                        <?php echo $product['html']; ?>
23
+                    </div>
24
+                <?php endforeach; ?>
25
+                <?php foreach ($this->products as $product) : ?>
26
+                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
27
+                        <?php echo $product['html']; ?>
28
+                    </div>
29
+                <?php endforeach; ?>
30
+                <?php foreach ($this->products as $product) : ?>
31
+                    <div<?php echo $product['cssID']; ?> class="swiper-slide <?php echo $product['class']; ?>">
32
+                        <?php echo $product['html']; ?>
33
+                    </div>
34
+                <?php endforeach; ?>
35
+            </div>
36
+        </div>
37
+        <div class="product-slider_<?= $this->id; ?> swiper-button-prev"></div>
38
+        <div class="product-slider_<?= $this->id; ?> swiper-button-next"></div>
39
+    </div>
40
+
41
+<?php endif; ?>
42
+
43
+    <script>
44
+        window.addEventListener('load', function () {
45
+            if ($('.swiper.product-slider_<?= $this->id;?>').length) {
46
+
47
+                const swiper_<?php echo $this->id; ?> = new Swiper('.swiper.product-slider_<?= $this->id;?>', {
48
+                    navigation: {
49
+                        nextEl: '.product-slider_<?= $this->id;?>.swiper-button-next',
50
+                        prevEl: '.product-slider_<?= $this->id;?>.swiper-button-prev',
51
+                    },
52
+
53
+                    direction: 'horizontal',
54
+                    loop: true,
55
+                    preloadImages: true,
56
+                    slidesPerView: 1,
57
+                    breakpoints: {
58
+                        600: {
59
+                            slidesPerView: 2,
60
+                            spaceBetween: 50,
61
+                        },
62
+
63
+                        992: {
64
+                            slidesPerView: <?= $this->iso_cols;?>,
65
+                            spaceBetween: 50,
66
+                        },
67
+
68
+                        1400: {
69
+                            slidesPerView: 4,
70
+                            spaceBetween: 50,
71
+                        },
72
+
73
+                    }
74
+                });
75
+            }
76
+        }, {passive: true})
77
+    </script>
78
+
79
+<?php $this->endblock(); ?>
0 80
\ No newline at end of file