<div class="slide-mask">
<div class="bg-image h-full bg-cover bg-no-repeat slide-img ">
<!--<div class="bg-image-sizer" style="padding-bottom: 110.417%;">-->
- <img class="img-slider" draggable="false" src="https://staging.pm-instrumentation.com/storage/uploads/images/home-car.jpg" alt="">
+ <img class="img-slider" draggable="false" ondragstart="return false;" src="https://staging.pm-instrumentation.com/storage/uploads/images/home-car.jpg" alt="">
<!--</div>-->
</div>
</div>
<div class="slide-mask">
<div class="bg-image h-full bg-cover bg-no-repeat slide-img">
<!--<div class="bg-image-sizer" style="padding-bottom: 110.417%;">-->
- <img class="img-slider" draggable="false" src="https://www.sciencesetavenir.fr/assets/img/2019/04/10/cover-r4x3w1000-5cadebdd93968-trou-noir-galaxie.jpg" alt="">
+ <img class="img-slider" draggable="false" ondragstart="return false;" src="https://www.sciencesetavenir.fr/assets/img/2019/04/10/cover-r4x3w1000-5cadebdd93968-trou-noir-galaxie.jpg" alt="">
<!--</div>-->
</div>
<div class="slide-mask">
<div class="bg-image h-full bg-cover bg-no-repeat slide-img">
<!--<div class="bg-image-sizer" style="padding-bottom: 110.417%;">-->
- <img class="img-slider" draggable="false" src="https://staging.pm-instrumentation.com/storage/uploads/images/home-car.jpg" alt="">
+ <img class="img-slider" draggable="false" ondragstart="return false;" src="https://staging.pm-instrumentation.com/storage/uploads/images/home-car.jpg" alt="">
</div>
</div>
<div class="slide-mask">
<div class="bg-image h-full bg-cover bg-no-repeat slide-img">
<!--<div class="bg-image-sizer" style="padding-bottom: 110.417%;">-->
- <img class="img-slider" draggable="false" src="https://www.w3schools.com/w3css/img_lights.jpg" alt="">
+ <img class="img-slider" draggable="false" ondragstart="return false;" src="https://www.w3schools.com/w3css/img_lights.jpg" alt="">
</div>
</div>
</div>
this.final = 'px 0px)';
this.container = this.element.find('.slider');
-
this.hammerSwipe.get('swipe').set({ enable: true });
this.initt();
};
$(window).on('resize', function () {
$this.resize();
});
+
+ this.autoSlideDelay = 4; // automatic slideshow delay
+ this.slideInterval = window.setTimeout(function () {
+ $this.nextSlide();
+ }, this.autoSlideDelay*1000);
+
this.resize();
this.initSwipeEvent();
this.enableArrows();
- // this.automaticSlideshow();
+ this.automaticSlideshow();
this.indicator();
},
$this.hammerSwipe.get('swipe').set({enable: true}); // swipe functionality is now reactivate
$this.currentSlideIndex.removeClass('active').eq($this.index);
+ $this.slideInterval = setTimeout(function () {
+ $this.nextSlide();
+ }, $this.autoSlideDelay*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,
ease: Power3.easeOut
};
- if ($(window).width() > 768) {
+ if ($(window).outerWidth() > 768) {
TweenMax.set($this.element.find('.slide-img'), {
clip: $this.init + $this.width + 'px ' + $this.height + $this.final,
ease: Power3.easeOut
indicator: function(){
let $this= this;
$('.slider-position').on('click',function () {
- let direction = -1;
- let pos = $(this).data('position');
+ let direction = 1;
+ let nextPosition= $(this).data('position');
+ let currentPosition = $this.index;
+
+ clearTimeout($this.slideInterval);
- if (pos<direction){
- this.direction = -1;
+ if (currentPosition< nextPosition){
+ direction = 1;
}
- else if(pos>direction){
- this.direction = 1;
+ else if(currentPosition > nextPosition){
+ direction = -1;
}
- else if(pos=direction){
- this.goToSlide(pos,direction).off();
+ else if(currentPosition == nextPosition){
+ return false;
}
- console.log(pos,direction);
-
- // DETERMINER la direction en fonction de la position
- $this.goToSlide(pos,direction);
- // console.log(direction);
+ $this.goToSlide(nextPosition,direction);
});
},
- // autoSlide: function () {
- // let $this = this;
- //
- // let myVar = setInterval(function () {
- // $this.nextSlide();
- // }, 4000);
- // },
-
- // automaticSlideshow:function(){
- // // this.autoSlide();
- //
- // let $this = this;
- //
- // let myVar = setInterval(function () {
- // $this.nextSlide();
- // }, 4000);
- //
- // $(".arrow").on('click',function () {
- // // $this.autoSlide.off();
- // // clearInterval(myVar);
- // // alert('test');
- // })
- // },
+ automaticSlideshow:function(){
+
+ let $this = this;
+ this.element.find(".arrow").on('click',function () {
+ // window.clearTimeout($this.slideInterval);
+ window.clearTimeout($this.slideInterval);
+
+ alert($this.slideInterval);
+ });
+ },
initSwipeEvent: function (){
let $this = this;
this.hammerSwipe.on('swiperight', function() {
$this.prevSlide();
+ clearTimeout($this.slideInterval);
});
this.hammerSwipe.on('swipeleft', function() {
$this.nextSlide();
+ clearTimeout($this.slideInterval);
});
},