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;
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
});
});
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, {
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 + '%') + ')',