*/
var FilmSlider;
-
(function(){
var keyLeft = 37, keyRight = 39;
var src = this.image.src.replace(imgRequestedSize, 'size=' + bestFitSize);
this.pendingImage.src = src;
}
+ this.adjustImage(this.image);
};
FilmSlider.prototype.getBestFitSize = function(ratio) {
return DEFAULT_IMAGE_SIZES[i];
};
+FilmSlider.prototype.adjustImage = function(img) {
+ var dispWidth = parseInt(this.stretchable.style.width, 10);
+ var imgWidth = img.naturalWidth;
+ var dispHeight = parseInt(this.stretchable.style.height, 10);
+ var imgHeight = img.naturalHeight;
+ var ratio;
+
+ if (imgHeight > dispHeight) {
+ ratio = dispHeight / imgHeight;
+ imgWidth = imgWidth * ratio;
+ imgHeight = dispHeight;
+ }
+ if (imgWidth > dispWidth) {
+ ratio = dispWidth / imgWidth;
+ imgHeight = imgHeight * ratio;
+ imgWidth = dispWidth;
+ }
+ img.width = imgWidth;
+ img.height = imgHeight;
+};
+
if (!browser.isMobile) {
FilmSlider.prototype.centerSlide = function(slideIndex) {
if (this.sliderRatio > 1) { return; }
};
FilmSlider.prototype.refreshImage = function() {
+ this.adjustImage(this.pendingImage);
this.image.style.visibility = 'hidden';
this.image.src = this.pendingImage.src;
this.image.width = this.pendingImage.width;
}
if (leftSize > rightSize) {
for (i = this.center - rightSize - 1 ; i >= 0 ; i--) {
- console.log(i);
this.thumbnailsLoadingOrder.push(thumbnails[i]);
}
}
else if (leftSize < rightSize) {
- for (i = this.center + leftSize ; i < thumbnails.length ; i++) {
+ for (i = this.center + leftSize + 1 ; i < thumbnails.length ; i++) {
this.thumbnailsLoadingOrder.push(thumbnails[i]);
}
}