X-Git-Url: https://scm.cri.ensmp.fr/git/Portfolio.git/blobdiff_plain/1a28edcbf9b0c46fbab9bcc9fff0b065349f8f24..fbdbc13c9f32f9df94087780ce90bc0916bde420:/skins/photo_film_viewer.js?ds=sidebyside diff --git a/skins/photo_film_viewer.js b/skins/photo_film_viewer.js index 566984a..c6f583b 100644 --- a/skins/photo_film_viewer.js +++ b/skins/photo_film_viewer.js @@ -5,7 +5,6 @@ Licence Creative Commons http://creativecommons.org/licenses/by-nc/2.0/ */ var FilmSlider; - (function(){ var keyLeft = 37, keyRight = 39; @@ -114,7 +113,14 @@ if (!browser.isMobile) { else { // pas de barre de scroll horizontal pour les tablettes - FilmSlider.prototype.resizeSlider = function(evt) {}; + FilmSlider.prototype.resizeSlider = function(evt) { + this.filmMaxX = - (getObjectWidth(this.film) - this.filmBarWidth); + if (!this.initialized) { + this.centerSlide(this.center); + this.selectedSlide = this.filmBar.getElementsByTagName('img')[this.center].parentNode; + this.initialized = true; + } + }; } FilmSlider.prototype._checkSizeAfterLoad = function(evt) { @@ -139,10 +145,11 @@ FilmSlider.prototype._checkSize = function(evt) { FilmSlider.prototype._checkSizeStability = function(evt) { var self = this; var i; + var checkAgain = function(evt){self._checkSizeStability();}; for (i=0 ; i rightSize) { + for (i = this.center - rightSize - 1 ; i >= 0 ; i--) { + this.thumbnailsLoadingOrder.push(thumbnails[i]); + } + } + else if (leftSize < rightSize) { + for (i = this.center + leftSize + 1 ; i < thumbnails.length ; i++) { + this.thumbnailsLoadingOrder.push(thumbnails[i]); + } } + var next = this.thumbnailsLoadingOrder.shift(); + var self = this; + addListener(next, 'load', function(evt){self._loadNextThumb(evt);}); + next.src = this.translateImgUrl(next.parentNode.href) + '/getThumbnail'; +}; + +FilmSlider.prototype._loadNextThumb = function(evt) { + var next = this.thumbnailsLoadingOrder.shift(); + if (!next) {return;} + var self = this; + addListener(next, 'load', function(evt){self._loadNextThumb(evt);}); + next.src = this.translateImgUrl(next.parentNode.href) + '/getThumbnail'; }; + FilmSlider.prototype.startSlideShow = function() { this.slideShowSlide = this.pendingSlideShowSlide = this.selectedSlide; return this.slideShowSlide.href;