]> _ Git - pmi.git/commitdiff
set sizes according to webflow | wait #3016 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2019 14:42:40 +0000 (16:42 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 9 Sep 2019 14:42:40 +0000 (16:42 +0200)
resources/js/carrousel.js
resources/styles/components/carrousel.styl
resources/views/pages/home.blade.php

index cec155d66bfdf3647fd57144a4f86f2212317fa8..6a35dba3767fda4cb9eea3b750f87c43444968ac 100644 (file)
@@ -1,6 +1,7 @@
 import TweenMax from "gsap/TweenMax";
 import TimelineMax from "gsap/TimelineMax";
 import * as Hammer from 'hammerjs';
+import fa from "../../public/vendor/adminlte/bower_components/moment/src/locale/fa";
 
 window.Hammer = Hammer.default;
 
@@ -85,22 +86,34 @@ window.Hammer = Hammer.default;
 
         resize: function () {
             let $this = this;
-            this.element.find('.img-slider').each(function () {
-                let width = $this.element.find('.slide-img').eq($this.index).width(),
-                    height = $this.element.find('.slide-img').eq($this.index).height();
 
+            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'),
                     naturalWidth = $(this).prop('naturalWidth');
 
                 let getAllImg = new Image();
                 getAllImg.src = $(this).attr("src");
 
-                let widthFactor = width / naturalWidth,  // coef multiplicateur width
-                    heightFactor = height / naturalHeight; // coef multiplicateur height
-
-                TweenMax.set($(this), {
-                    width: naturalWidth * Math.max(widthFactor, heightFactor),
-                    height: naturalHeight * Math.max(widthFactor, heightFactor)
+                let widthFactor = cw / naturalWidth,  // coef multiplicateur width
+                    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;
+                var top = (ch - ih) / 2;
+
+                $(this).css({
+                    width: iw,
+                    height: ih,
+                    top: top,
+                    left: left
                 });
             });
 
@@ -174,8 +187,8 @@ window.Hammer = Hammer.default;
                     opacity: 0,
                 }, {ease: Power1.easeOut, opacity: 1, x: 0}, 0.6);
 
-                tl.from($this.nextContainerImg, 1.2 * $this.multiplyDuration, {
-                    x: 150 * direction,
+                tl.from($this.nextContainerImg, 0.7 * $this.multiplyDuration, {
+                    x: 100 * direction,
                     ease: Power2.easeInOut
                 }, 0); // initial delay value 1.5s
                 tl.to($this.currentContainerImg, 1.2 * $this.multiplyDuration, {
@@ -199,7 +212,7 @@ window.Hammer = Hammer.default;
                 tl2.to($this.currentSlideIndex, 0.7, {
                     transform: 'translateX(' + ($this.negativePercent + '%') + ')',
                     ease: Power1.easeOut
-                },0);
+                }, 0);
 
                 tl2.from($this.nextSlideIndex, 0.7, {
                     transform: 'translateX(' + ($this.percent + '%') + ')',
index 57da66a9169c86ad12b4e4018bac5f34901eace1..e951b48ee111c7d4f16a40bc16b2bd34b02cb8fc 100644 (file)
@@ -58,8 +58,9 @@
   .slider
     width: 100%
     position relative
-    height 80vh
+    height 620px
     @media (max-width 769px)
+      height calc(100vh - 134px)
       overflow hidden
 
   .slide
@@ -72,6 +73,7 @@
     overflow hidden
     height 100%
     position relative
+    max-height 720px
 
   .slider-indicator
     position absolute
index 85723bcf3bc87fc050edf8ee765adb564af97eb8..02caa759312c7fda673e861004d8bf508f84354f 100644 (file)
@@ -21,7 +21,7 @@
                 @foreach($page->get('slideshow') as $i=>$slide)
                     <div class="column-wrapper absolute slide hide">
 
-                        <column class="slide-content slide-txt pt-2v pr-1v pb-2v">
+                        <column class="slide-content slide-txt pt-1v pr-1v pb-2v">
                             <div class="mobile-bg"
                                  style="background-image: url({{$page->getImageURLByCollection($slide['image'])}})"></div>