prevent touchmove default action on android (#143)

edit
Hakim El Hattab 2012-10-04 09:32:20 -04:00
parent 6af14aca0f
commit 43c8990f2b
2 changed files with 17 additions and 12 deletions

View File

@ -1,5 +1,5 @@
/*! /*!
* reveal.js 2.1 r27 * reveal.js 2.1 r28
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
@ -485,6 +485,11 @@ var Reveal = (function(){
event.preventDefault(); event.preventDefault();
} }
// There's a bug with swiping on some Android devices unless
// the default action is always prevented
else if( navigator.userAgent.match( /android/gi ) ) {
event.preventDefault();
}
} }
/** /**

22
js/reveal.min.js vendored
View File

@ -1,5 +1,5 @@
/*! /*!
* reveal.js 2.1 r27 * reveal.js 2.1 r28
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
@ -32,16 +32,16 @@ V.startCount=ac.touches.length;if(ac.touches.length===2){V.startSpan=N({x:ac.tou
var ae=ah.touches[0].clientY;if(ah.touches.length===2&&V.startCount===2){var ag=N({x:ah.touches[1].clientX,y:ah.touches[1].clientY},{x:V.startX,y:V.startY}); var ae=ah.touches[0].clientY;if(ah.touches.length===2&&V.startCount===2){var ag=N({x:ah.touches[1].clientX,y:ah.touches[1].clientY},{x:V.startX,y:V.startY});
if(Math.abs(V.startSpan-ag)>V.threshold){V.handled=true;if(ag<V.startSpan){F();}else{X();}}}else{if(ah.touches.length===1){var ad=af-V.startX,ac=ae-V.startY; if(Math.abs(V.startSpan-ag)>V.threshold){V.handled=true;if(ag<V.startSpan){F();}else{X();}}}else{if(ah.touches.length===1){var ad=af-V.startX,ac=ae-V.startY;
if(ad>V.threshold&&Math.abs(ad)>Math.abs(ac)){V.handled=true;y();}else{if(ad<-V.threshold&&Math.abs(ad)>Math.abs(ac)){V.handled=true;h();}else{if(ac>V.threshold){V.handled=true; if(ad>V.threshold&&Math.abs(ad)>Math.abs(ac)){V.handled=true;y();}else{if(ad<-V.threshold&&Math.abs(ad)>Math.abs(ac)){V.handled=true;h();}else{if(ac>V.threshold){V.handled=true;
r();}else{if(ac<-V.threshold){V.handled=true;C();}}}}}}ah.preventDefault();}}function R(ac){V.handled=false;}function m(ac){clearTimeout(w);w=setTimeout(function(){var ad=ac.detail||-ac.wheelDelta; r();}else{if(ac<-V.threshold){V.handled=true;C();}}}}}}ah.preventDefault();}else{if(navigator.userAgent.match(/android/gi)){ah.preventDefault();}}}function R(ac){V.handled=false;
if(ad>0){u();}else{T();}},100);}function t(ac){G();}function A(ac){if(U()){ac.preventDefault();X();k=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v"); }function m(ac){clearTimeout(w);w=setTimeout(function(){var ad=ac.detail||-ac.wheelDelta;if(ad>0){u();}else{T();}},100);}function t(ac){G();}function A(ac){if(U()){ac.preventDefault();
a();}}function I(){if(O&&!("msPerspective" in document.body.style)){var ad=document.querySelectorAll(".reveal .slides section a:not(.image)");for(var ae=0,ac=ad.length; X();k=this.getAttribute("data-index-h");c=this.getAttribute("data-index-v");a();}}function I(){if(O&&!("msPerspective" in document.body.style)){var ad=document.querySelectorAll(".reveal .slides section a:not(.image)");
ae<ac;ae++){var af=ad[ae];if(af.textContent&&!af.querySelector("img")&&(!af.className||!af.classList.contains(af,"roll"))){af.classList.add("roll");af.innerHTML='<span data-title="'+af.text+'">'+af.innerHTML+"</span>"; for(var ae=0,ac=ad.length;ae<ac;ae++){var af=ad[ae];if(af.textContent&&!af.querySelector("img")&&(!af.className||!af.classList.contains(af,"roll"))){af.classList.add("roll");
}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=document.querySelectorAll(j);for(var ah=0,af=ac.length;ah<af;ah++){var ae=ac[ah],al="translateZ(-2500px) translate("+((ah-k)*105)+"%, 0%)"; af.innerHTML='<span data-title="'+af.text+'">'+af.innerHTML+"</span>";}}}}function F(){if(M.overview){d.wrapper.classList.add("overview");var ac=document.querySelectorAll(j);
ae.setAttribute("data-index-h",ah);ae.style.display="block";ae.style.WebkitTransform=al;ae.style.MozTransform=al;ae.style.msTransform=al;ae.style.OTransform=al; for(var ah=0,af=ac.length;ah<af;ah++){var ae=ac[ah],al="translateZ(-2500px) translate("+((ah-k)*105)+"%, 0%)";ae.setAttribute("data-index-h",ah);ae.style.display="block";
ae.style.transform=al;if(!ae.classList.contains("stack")){ae.addEventListener("click",A,true);}var ak=ae.querySelectorAll("section");for(var ag=0,ad=ak.length; ae.style.WebkitTransform=al;ae.style.MozTransform=al;ae.style.msTransform=al;ae.style.OTransform=al;ae.style.transform=al;if(!ae.classList.contains("stack")){ae.addEventListener("click",A,true);
ag<ad;ag++){var aj=ak[ag],ai="translate(0%, "+((ag-(ah===k?c:0))*105)+"%)";aj.setAttribute("data-index-h",ah);aj.setAttribute("data-index-v",ag);aj.style.display="block"; }var ak=ae.querySelectorAll("section");for(var ag=0,ad=ak.length;ag<ad;ag++){var aj=ak[ag],ai="translate(0%, "+((ag-(ah===k?c:0))*105)+"%)";aj.setAttribute("data-index-h",ah);
aj.style.WebkitTransform=ai;aj.style.MozTransform=ai;aj.style.msTransform=ai;aj.style.OTransform=ai;aj.style.transform=ai;aj.addEventListener("click",A,true); aj.setAttribute("data-index-v",ag);aj.style.display="block";aj.style.WebkitTransform=ai;aj.style.MozTransform=ai;aj.style.msTransform=ai;aj.style.OTransform=ai;
}}}}function X(){if(M.overview){d.wrapper.classList.remove("overview");var af=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section")); aj.style.transform=ai;aj.addEventListener("click",A,true);}}}}function X(){if(M.overview){d.wrapper.classList.remove("overview");var af=Array.prototype.slice.call(document.querySelectorAll(".reveal .slides section"));
for(var ae=0,ac=af.length;ae<ac;ae++){var ad=af[ae];ad.style.WebkitTransform="";ad.style.MozTransform="";ad.style.msTransform="";ad.style.OTransform=""; for(var ae=0,ac=af.length;ae<ac;ae++){var ad=af[ae];ad.style.WebkitTransform="";ad.style.MozTransform="";ad.style.msTransform="";ad.style.OTransform="";
ad.style.transform="";ad.removeEventListener("click",A);}a();}}function U(){return d.wrapper.classList.contains("overview");}function aa(ad,af){var ah=Array.prototype.slice.call(document.querySelectorAll(ad)),ai=ah.length; ad.style.transform="";ad.removeEventListener("click",A);}a();}}function U(){return d.wrapper.classList.contains("overview");}function aa(ad,af){var ah=Array.prototype.slice.call(document.querySelectorAll(ad)),ai=ah.length;
if(ai){if(M.loop){af%=ai;if(af<0){af=ai+af;}}af=Math.max(Math.min(af,ai-1),0);for(var ag=0;ag<ai;ag++){var ac=ah[ag];if(U()===false){var aj=Math.abs((af-ag)%(ai-3))||0; if(ai){if(M.loop){af%=ai;if(af<0){af=ai+af;}}af=Math.max(Math.min(af,ai-1),0);for(var ag=0;ag<ai;ag++){var ac=ah[ag];if(U()===false){var aj=Math.abs((af-ag)%(ai-3))||0;