(function ($) {
function JQPMISlide(element) {
- console.log(':))', element);
this.element = element;
this.pmiSlider = this.element.get(0);
this.hammerSwipe = new Hammer(this.pmiSlider);
this.width = this.element.find('.slide-img').width(); // --> clip container width
this.height = this.element.find('.slide-img').height(); // --> clip container height
- this.init = 'rect(0px ';
- this.final = 'px 0px)';
+ this.initRect = 'rect(0px ';
+ this.finalRect = 'px 0px)';
this.container = this.element.find('.slider');
this.hammerSwipe.get('swipe').set({enable: true});
- this.initt();
+ this.init();
};
JQPMISlide.prototype = {
- initt: function () {
+ init: function () {
+ var $this = this;
+ var i = 0;
+ this.container.find(".slide").each(function () {
+ console.log(this);
+ if (i === 0) {
+ $(this).addClass('active').removeClass('hide');
+ } else {
+ $(this).addClass('hide').removeClass('active');
+ }
+ $this.container.find('.slider-indicator ul').append('<li class="slider-position' + (i === 0 ? ' active-indicator' : '') + '" data-position="' + i + '"></li>')
+ i++;
+ });
+
+ $this.element.addClass('visible');
+
this.initEvents();
},
$this.resize();
});
- this.autoSlideDelay = 4; // automatic slideshow delay
+ this.autoSlideDuration = 8; // automatic slideshow delay
this.slideInterval = window.setTimeout(function () {
$this.nextSlide();
- }, this.autoSlideDelay * 1000);
+ }, this.autoSlideDuration * 1000);
this.resize();
this.initSwipeEvent();
let width = $(this).width(), // --> container width (clip container)
height = $(this).height(); // --> container height (clip container)
- TweenMax.set($(this), {clip: $this.init + width + 'px ' + height + $this.final, ease: Power3.easeOut}); // on resize apply new width/height to clip container
+ TweenMax.set($(this), {
+ clip: $this.initRect + width + 'px ' + height + $this.finalRect,
+ ease: Power3.easeOut
+ }); // on resize apply new width/height to clip container
});
},
if ($this.automode) {
$this.slideInterval = setTimeout(function () {
$this.nextSlide();
- }, $this.autoSlideDelay * 1000);
+ }, $this.autoSlideDuration * 1000);
}
$this.enableArrows(); // when animation is finished we reactivate click event
$this.automaticSlideshow();
TweenMax.set($this.element.find('.slide-img'), {
- clip: $this.init + $this.width + 'px ' + $this.height + $this.final,
+ clip: $this.initRect + $this.width + 'px ' + $this.height + $this.finalRect,
ease: Power3.easeOut
});
if ($(window).outerWidth() > 768) {
TweenMax.set($this.element.find('.slide-img'), {
- clip: $this.init + $this.width + 'px ' + $this.height + $this.final,
+ clip: $this.initRect + $this.width + 'px ' + $this.height + $this.finalRect,
ease: Power3.easeOut
});
ease: Power1.easeOut
});
tl.to($this.currentContainerImg, 2 * $this.Delay, {
- clip: $this.init + (direction) * -1 * $this.imgWidth + 'px,' + $this.height + 'px,' + (direction) * -1 * $this.imgWidth + 'px',
+ clip: $this.initRect + (direction) * -1 * $this.imgWidth + 'px,' + $this.height + 'px,' + (direction) * -1 * $this.imgWidth + 'px',
ease: Power2.easeInOut
}, "-=" + 0.8 * $this.Delay);
});
},
- endAutomode:function(){
- this.automode=false;
+ endAutomode: function () {
+ this.automode = false;
clearTimeout(this.slideInterval);
},
</div>
<div id="pmiSlider" class="slider relative">
@foreach($page->get('slideshow') as $i=>$slide)
- <div data-slide="{{$i+1}}"
- class="column-wrapper absolute slide @if($i==0) active @else hide @endif">
+ <div class="column-wrapper absolute slide hide">
<column class="slide-content slide-txt pt-2v pr-1v pb-2v">
<div class="mobile-bg"
@endforeach
<div class="slider-indicator">
<ul class="pl-2v">
- @foreach($page->get('slideshow') as $i=>$slide)
- <li class="slider-position @if($i==0) active-indicator @endif" data-position="{{$i}}"></li>
- @endforeach
</ul>
</div>
</div>
<full-width class="bg-grey-100">
<content>
- <text-block class="mb-2v" title="Nos Produits"/>
+ <text-block class="mb-2v" :title="__('Nos Produits')"/>
<columns>
<column>