mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
menu: make swipe handler passive #735
This commit is contained in:
parent
b19ca89f44
commit
5d06241911
1 changed files with 9 additions and 12 deletions
|
@ -1087,7 +1087,6 @@ function initSwipeHandler(){
|
||||||
var handleStartX = function(evt) {
|
var handleStartX = function(evt) {
|
||||||
startx = evt.touches[0].clientX;
|
startx = evt.touches[0].clientX;
|
||||||
starty = evt.touches[0].clientY;
|
starty = evt.touches[0].clientY;
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
var handleMoveX = function(evt) {
|
var handleMoveX = function(evt) {
|
||||||
if( startx !== null ){
|
if( startx !== null ){
|
||||||
|
@ -1104,24 +1103,22 @@ function initSwipeHandler(){
|
||||||
closeNav();
|
closeNav();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
var handleEndX = function(evt) {
|
var handleEndX = function(evt) {
|
||||||
startx = null;
|
startx = null;
|
||||||
starty = null;
|
starty = null;
|
||||||
return false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var s = document.querySelector( '#R-body-overlay' );
|
var s = document.querySelector( '#R-body-overlay' );
|
||||||
s && s.addEventListener("touchstart", handleStartX, false);
|
s && s.addEventListener("touchstart", handleStartX, { capture: false, passive: true});
|
||||||
document.querySelector( '#R-sidebar' ).addEventListener("touchstart", handleStartX, false);
|
document.querySelector( '#R-sidebar' ).addEventListener("touchstart", handleStartX, { capture: false, passive: true});
|
||||||
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchstart", handleStartX); }, false);
|
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchstart", handleStartX, { capture: false, passive: true}) });
|
||||||
s && s.addEventListener("touchmove", handleMoveX, false);
|
s && s.addEventListener("touchmove", handleMoveX, { capture: false, passive: true});
|
||||||
document.querySelector( '#R-sidebar' ).addEventListener("touchmove", handleMoveX, false);
|
document.querySelector( '#R-sidebar' ).addEventListener("touchmove", handleMoveX, { capture: false, passive: true});
|
||||||
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchmove", handleMoveX); }, false);
|
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchmove", handleMoveX, { capture: false, passive: true}) });
|
||||||
s && s.addEventListener("touchend", handleEndX, false);
|
s && s.addEventListener("touchend", handleEndX, { capture: false, passive: true});
|
||||||
document.querySelector( '#R-sidebar' ).addEventListener("touchend", handleEndX, false);
|
document.querySelector( '#R-sidebar' ).addEventListener("touchend", handleEndX, { capture: false, passive: true});
|
||||||
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchend", handleEndX); }, false);
|
document.querySelectorAll( '#R-sidebar *' ).forEach( function(e){ e.addEventListener("touchend", handleEndX, { capture: false, passive: true}) });
|
||||||
}
|
}
|
||||||
|
|
||||||
function initImage(){
|
function initImage(){
|
||||||
|
|
Loading…
Reference in a new issue