'out' : function(evt){thisSlider.mouseOutHandler(evt);}
};
- this.resizeSlider();
+ if (browser.isMobile) {
+ this.rail.className = 'hidden';
+ }
+ else {
+ this.resizeSlider();
+ }
this.addEventListeners();
};
-
-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';
- }
+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';
+ }
- 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 {
+ // pas de barre de scroll horizontal pour les tablettes
+ FilmSlider.prototype.resizeSlider = function(evt) {};
+}
FilmSlider.prototype._checkSizeAfterLoad = function(evt) {
this._barSizes = [];
}
}
clearInterval(this._checkSizeIntervalId);
- delete this._barSizes, this._checkSizeIntervalId;
+ delete this._barSizes;
+ delete this._checkSizeIntervalId;
};
FilmSlider.prototype.fitToScreen = 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;
else if (browser.isIE6up) {
addListener(this.filmBar, 'mousewheel', function(evt){thisSlider.mouseWheelHandler(evt);});
}
+ if (browser.isMobile) {
+ this.filmBar.addEventListener('touchstart', function(evt){thisSlider.touchStartHandler(evt);}, false);
+ this.filmBar.addEventListener('touchmove', function(evt){thisSlider.touchMoveHandler(evt);}, false);
+ this.filmBar.addEventListener('touchend', function(evt){thisSlider.touchEndHandler(evt);}, false);
+ }
addListener(document, 'keydown', function(evt){thisSlider.keyDownHandler(evt);});
addListener(document, 'keypress', function(evt){thisSlider.keyPressHandler(evt);});
};
}
+FilmSlider.prototype.touchStartHandler = function(evt) {
+ this.filmStartX = parseInt(this.film.style.left, 10);
+ this.touchStartX = evt.pageX;
+};
+
+FilmSlider.prototype.touchMoveHandler = function(evt) {
+ var delta = this.touchStartX - evt.pageX;
+ var posX = Math.min(0, this.filmStartX - delta);
+ this.film.style.left = String(posX) + 'px';
+};
+
+FilmSlider.prototype.touchEndHandler = function(evt) {
+ this.touchStartX = undefined;
+};
+
+
FilmSlider.prototype.keyDownHandler = function(evt) {
evt = getEventObject(evt);
switch (evt.keyCode) {
break;
case 'imageattributes' :
var link = this.buttons.back_to_portfolio.parentNode;
- link.href = element.getAttribute('backToContextUrl');
+ link.href = element.getAttribute('back_to_context_url');
link = this.buttons.show_buyable.parentNode;
var buyable = element.getAttribute('buyable');
if(buyable === 'True') { link.className = null; }
else if(buyable === 'False') { link.className = 'hidden'; }
this.image.alt = element.getAttribute('alt');
- this.updateBreadcrumbs(element.getAttribute('lastBcUrl'),
+ this.updateBreadcrumbs(element.getAttribute('last_bc_url'),
element.getAttribute('img_id'));
break;
}