]> _ Git - pmi.git/commitdiff
fix #3017 @0:05
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2019 14:46:18 +0000 (16:46 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2019 14:46:18 +0000 (16:46 +0200)
resources/js/carrousel.js
resources/views/pages/home.blade.php

index 6a35dba3767fda4cb9eea3b750f87c43444968ac..e239c5183c91fec69ffbdb5d22345368e3d8298e 100644 (file)
@@ -14,7 +14,11 @@ window.Hammer = Hammer.default;
         this.slideLength = this.element.find(".slide").length;
 
         this.transitionning = false;
-        this.automode = true;
+        this.automode = this.slideLength > 1;
+
+        if (this.slideLength <= 1) {
+            this.element.find('.slider-control,.slider-indicator').hide();
+        }
 
         this.prevBtn = this.element.find(".home-arrow-left");
         this.nextBtn = this.element.find(".home-arrow-right");
@@ -69,9 +73,11 @@ window.Hammer = Hammer.default;
             this.autoSlideDuration = 8; // automatic slideshow delay
 
             this.resize();
-            this.initSwipeEvent();
-            this.enableArrows();
-            this.indicator();
+            if (this.slideLength > 1) {
+                this.initSwipeEvent();
+                this.enableArrows();
+                this.indicator();
+            }
         },
 
         automaticSlideshow: function () {
@@ -90,7 +96,6 @@ window.Hammer = Hammer.default;
             var cw = this.element.outerWidth() / 2;
             var ch = 720;
 
-            console.log(cw, ch);
 
             this.element.find('.img-slider').each(function () {
                 let naturalHeight = $(this).prop('naturalHeight'),
@@ -103,7 +108,7 @@ window.Hammer = Hammer.default;
                     heightFactor = ch / naturalHeight; // coef multiplicateur height
 
                 var factor = Math.max(widthFactor, heightFactor);
-                console.log(factor);
+
                 var iw = naturalWidth * factor;
                 var ih = naturalHeight * factor;
                 var left = (cw * 0.5) + (cw - iw) / 2;
index 02caa759312c7fda673e861004d8bf508f84354f..8f6875329d9a2b3b592c75347bf85f6593c28f4c 100644 (file)
@@ -45,6 +45,7 @@
                         </column>
 
                     </div>
+                    @break
                 @endforeach
                 <div class="slider-indicator">
                     <ul class="pl-2v">