};
if (!browser.isMobile) {
-FilmSlider.prototype.resizeSlider = function(evt) {
- var filmBarWidth = this.filmBarWidth;
- if (!filmBarWidth) { return; }
- var filmWidth = this.slideSize * this.filmLength;
- var sliderRatio = this.sliderRatio = filmBarWidth / filmWidth;
- var sliderWidth = filmBarWidth * sliderRatio;
- this.rail.style.width = filmBarWidth + 'px';
- this.rail.style.display = 'block';
- this.rail.style.visibility = 'visible';
- if (sliderRatio < 1) {
- this.slider.style.width = Math.round(sliderWidth) + 'px';
- this.slider.style.visibility = 'visible';
- }
- else {
- this.slider.style.visibility = 'hidden';
- }
+ FilmSlider.prototype.resizeSlider = function(evt) {
+ var filmBarWidth = this.filmBarWidth;
+ if (!filmBarWidth) { return; }
+ var filmWidth = this.slideSize * this.filmLength;
+ var sliderRatio = this.sliderRatio = filmBarWidth / filmWidth;
+ var sliderWidth = filmBarWidth * sliderRatio;
+ this.rail.style.width = filmBarWidth + 'px';
+ this.rail.style.display = 'block';
+ this.rail.style.visibility = 'visible';
+ if (sliderRatio < 1) {
+ this.slider.style.width = Math.round(sliderWidth) + 'px';
+ this.slider.style.visibility = 'visible';
+ }
+ else {
+ this.slider.style.visibility = 'hidden';
+ }
- this.winSize = {'width' : getWindowWidth(),
- 'height' : getWindowHeight()};
- this.maxRightPosition = filmBarWidth - sliderWidth;
- this.sliderSpeedRatio = - (filmBarWidth - sliderWidth) / (filmWidth - filmBarWidth);
- if (!this.initialized) {
- this.centerSlide(this.center);
- this.selectedSlide = this.filmBar.getElementsByTagName('img')[this.center].parentNode;
- this.initialized = true;
- }
-};
+ this.winSize = {'width' : getWindowWidth(),
+ 'height' : getWindowHeight()};
+ this.maxRightPosition = filmBarWidth - sliderWidth;
+ this.sliderSpeedRatio = - (filmBarWidth - sliderWidth) / (filmWidth - filmBarWidth);
+ if (!this.initialized) {
+ this.centerSlide(this.center);
+ this.selectedSlide = this.filmBar.getElementsByTagName('img')[this.center].parentNode;
+ this.initialized = true;
+ }
+ };
}
else {
- FilmSlider.prototype.resizeSlider = function(evt) {};
+ // pas de barre de scroll horizontal pour les tablettes
+ 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) {
FilmSlider.prototype._fitToScreen = function(evt) {
var wh = getWindowHeight();
- var rb = getObjectTop(this.rail) + getObjectHeight(this.rail); // rail bottom
+ if (!browser.isMobile) {
+ var rb = getObjectTop(this.rail) + getObjectHeight(this.rail); // rail bottom
+ }
+ else {
+ var rb = getObjectTop(this.filmBar) + getObjectHeight(this.filmBar); // film bottom
+ }
var delta = wh - rb;
var sh = getObjectHeight(this.stretchable);
var newSize = sh + delta;
return DEFAULT_IMAGE_SIZES[i];
};
-FilmSlider.prototype.centerSlide = function(slideIndex) {
- if (this.sliderRatio > 1) { return; }
- var filmBarWidth = getObjectWidth(this.filmBar);
- var x = slideIndex * this.slideSize;
- x = x - (filmBarWidth - this.slideSize) / 2.0;
- x = x * this.sliderSpeedRatio;
- var p = new Point( -x, 0 );
- this.setSliderPosition(p);
-};
+if (!browser.isMobile) {
+ FilmSlider.prototype.centerSlide = function(slideIndex) {
+ if (this.sliderRatio > 1) { return; }
+ var filmBarWidth = getObjectWidth(this.filmBar);
+ var x = slideIndex * this.slideSize;
+ x = x - (filmBarWidth - this.slideSize) / 2.0;
+ x = x * this.sliderSpeedRatio;
+ var p = new Point( -x, 0 );
+ this.setSliderPosition(p);
+ };
+}
+else {
+ FilmSlider.prototype.centerSlide = function(slideIndex) {
+ var filmBarWidth = getObjectWidth(this.filmBar);
+ var x = slideIndex * this.slideSize;
+ x = x - (filmBarWidth - this.slideSize) / 2.0;
+ this.setFilmPosition(-x);
+ };
+}
FilmSlider.prototype.setSliderPosition = function(point) {
if(point.x < 0) { point.x = 0; }
this.setFilmPosition(point);
};
-FilmSlider.prototype.setFilmPosition = function(point) {
- this.film.style.left = point.x / this.sliderSpeedRatio + 'px';
-};
+if (!browser.isMobile) {
+ FilmSlider.prototype.setFilmPosition = function(point) {
+ this.film.style.left = point.x / this.sliderSpeedRatio + 'px';
+ };
+}
+else {
+ FilmSlider.prototype.setFilmPosition = function(x) {
+ x = Math.min(0, x);
+ x = Math.max(this.filmMaxX, x);
+ this.film.style.left = String(x) + 'px';
+ };
+}
FilmSlider.prototype.getSliderPosition = function() {
var x = parseInt(this.slider.style.left, 10);
FilmSlider.prototype.touchMoveHandler = function(evt) {
var delta = this.touchStartX - evt.pageX;
- this.film.style.left = String(this.filmStartX - delta) + 'px';
+ var posX = this.filmStartX - delta;
+ this.setFilmPosition(posX);
};
FilmSlider.prototype.touchEndHandler = function(evt) {