Commit ec0d9e3d authored by Nikolay Gromov's avatar Nikolay Gromov

Закомментировал свайп оффканваса

parent e828e63e
...@@ -12,45 +12,45 @@ document.addEventListener('DOMContentLoaded', function(){ ...@@ -12,45 +12,45 @@ document.addEventListener('DOMContentLoaded', function(){
}); });
// реакция на свайп // реакция на свайп
document.addEventListener('touchstart', handleTouchStart, false); // document.addEventListener('touchstart', handleTouchStart, false);
document.addEventListener('touchmove', handleTouchMove, false); // document.addEventListener('touchmove', handleTouchMove, false);
var xDown = null; // var xDown = null;
var yDown = null; // var yDown = null;
function handleTouchStart(evt) { // function handleTouchStart(evt) {
xDown = evt.touches[0].clientX; // xDown = evt.touches[0].clientX;
yDown = evt.touches[0].clientY; // yDown = evt.touches[0].clientY;
}; // };
function handleTouchMove(evt) { // function handleTouchMove(evt) {
if ( ! xDown || ! yDown ) { // if ( ! xDown || ! yDown ) {
return; // return;
} // }
var xUp = evt.touches[0].clientX; // var xUp = evt.touches[0].clientX;
var yUp = evt.touches[0].clientY; // var yUp = evt.touches[0].clientY;
var xDiff = xDown - xUp; // var xDiff = xDown - xUp;
var yDiff = yDown - yUp; // var yDiff = yDown - yUp;
if(Math.abs( xDiff )+Math.abs( yDiff )>100){ //to deal with to short swipes // if(Math.abs( xDiff )+Math.abs( yDiff )>100){ //to deal with to short swipes
if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/ // if ( Math.abs( xDiff ) > Math.abs( yDiff ) ) {/*most significant*/
if ( xDiff > 0 ) {/* left swipe */ // if ( xDiff > 0 ) {/* left swipe */
document.getElementById('off-canvas').classList.remove('off-canvas--open'); // document.getElementById('off-canvas').classList.remove('off-canvas--open');
} else {/* right swipe */ // } else {/* right swipe */
document.getElementById('off-canvas').classList.add('off-canvas--open'); // document.getElementById('off-canvas').classList.add('off-canvas--open');
}
}
// else {
// if ( yDiff > 0 ) {/* up swipe */
// alert('Up!');
// } else { /* down swipe */
// alert('Down!');
// } // }
// } // }
/* reset values */ // // else {
xDown = null; // // if ( yDiff > 0 ) {/* up swipe */
yDown = null; // // alert('Up!');
} // // } else { /* down swipe */
}; // // alert('Down!');
// // }
// // }
// /* reset values */
// xDown = null;
// yDown = null;
// }
// };
function offCanvasToggle() { function offCanvasToggle() {
document.getElementById('off-canvas').classList.toggle('off-canvas--open'); document.getElementById('off-canvas').classList.toggle('off-canvas--open');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment