this.getImg.src = this.element.find('.img-slider').attr("src");
this.img = this.element.find('.img-slider');
+
this.imgWidth = this.getImg.naturalWidth;
+ this.width = this.img.width(); // --> clip container width
+ this.height = this.img.height(); // --> clip container height
- this.width = this.element.find('.slide-img').width(); // --> clip container width
- this.height = this.element.find('.slide-img').height(); // --> clip container height
this.initRect = 'rect(0px ';
this.finalRect = 'px 0px)';
resize: function () {
let $this = this;
- var cw = this.element.outerWidth() / 2;
+ var cw = this.element.find('.slider').width() / 2;
var ch = 720;
let naturalHeight = $(this).prop('naturalHeight'),
naturalWidth = $(this).prop('naturalWidth');
- let getAllImg = new Image();
- getAllImg.src = $(this).attr("src");
-
let widthFactor = cw / naturalWidth, // coef multiplicateur width
heightFactor = ch / naturalHeight; // coef multiplicateur height
var iw = naturalWidth * factor;
var ih = naturalHeight * factor;
- var left = (cw * 0.5) + (cw - iw) / 2;
+ var left = (cw - iw) / 2;
var top = (ch - ih) / 2;
$(this).css({