From: Benoît Pin Date: Fri, 11 Jul 2014 13:37:22 +0000 (+0200) Subject: +support interfaces tactiles. X-Git-Url: https://scm.cri.mines-paristech.fr/git/Portfolio.git/commitdiff_plain/a3732c58de2390b45546badf2e36cf4fe33c72aa?ds=sidebyside;hp=42326bd00929e6b3bae3c8f0618d5073852282b6 +support interfaces tactiles. bugfixes css. --- diff --git a/skins/photo_film_viewer.js b/skins/photo_film_viewer.js index 226e6dd..9bbf5ef 100644 --- a/skins/photo_film_viewer.js +++ b/skins/photo_film_viewer.js @@ -73,11 +73,16 @@ FilmSlider = function(filmBar, slider, ctxInfos, image, toolbar, breadcrumbs) { 'out' : function(evt){thisSlider.mouseOutHandler(evt);} }; - this.resizeSlider(); + if (browser.isMobile) { + this.rail.className = 'hidden'; + } + else { + this.resizeSlider(); + } this.addEventListeners(); }; - +if (!browser.isMobile) { FilmSlider.prototype.resizeSlider = function(evt) { var filmBarWidth = this.filmBarWidth; if (!filmBarWidth) { return; } @@ -105,6 +110,11 @@ FilmSlider.prototype.resizeSlider = function(evt) { this.initialized = true; } }; +} + +else { + FilmSlider.prototype.resizeSlider = function(evt) {}; +} FilmSlider.prototype._checkSizeAfterLoad = function(evt) { this._barSizes = []; @@ -261,6 +271,11 @@ FilmSlider.prototype.addEventListeners = function() { 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);}); @@ -564,6 +579,21 @@ else if (browser.isIE6up) { }; } +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; + this.film.style.left = String(this.filmStartX - delta) + 'px'; +}; + +FilmSlider.prototype.touchEndHandler = function(evt) { + this.touchStartX = undefined; +}; + + FilmSlider.prototype.keyDownHandler = function(evt) { evt = getEventObject(evt); switch (evt.keyCode) { diff --git a/skins/portfolio_style.css.dtml b/skins/portfolio_style.css.dtml index 4d62859..13a6782 100755 --- a/skins/portfolio_style.css.dtml +++ b/skins/portfolio_style.css.dtml @@ -364,7 +364,7 @@ div.lightbox { overflow:hidden; position:relative; width:100%; - height: px;; + height: px; } #film_bar table { @@ -378,8 +378,8 @@ div.lightbox { } #film_bar a { - width: px;; - height: px;; + width: px; + height: px; display:block; text-align:center; vertical-align:middle; @@ -428,7 +428,7 @@ div.lightbox { } #cart_slide[id] { - background:no-repeat url(&dtml-portal_url;/cart-slide-background.png);; + background:no-repeat url(&dtml-portal_url;/cart-slide-background.png); } .wdgt-buyable-items { @@ -484,7 +484,7 @@ input.add-to-cart-btn { border:none; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale src='&dtml-portal_url;/add_to_cart.png'); left:px; - top:2.5em;; + top:2.5em; } input.add-to-cart-btn[class] {