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");
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 () {
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'),
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;