add swipe event catcher

This commit is contained in:
2019-06-01 14:08:20 +02:00
parent fceb43515a
commit 304b1b171d
2 changed files with 20 additions and 0 deletions

View File

@@ -295,3 +295,18 @@ $.prototype.hoverSwap = function(sDefault, sHover)
})
.text(sDefault);
};
$.prototype.onSwipe = function(fCallBack){
return $(this)
.on('mousedown touchstart', function(e) {
var $This = $(this);
$This.data('x-down', e.pageX);
$This.data('y-down', e.pageY);
})
.on('mouseup touchend',function (e) {
var $This = $(this);
var iDeltaX = e.pageX - $This.data('x-down');
var iDeltaY = e.pageY - $This.data('y-down');
fCallBack({x:iDeltaX, y:iDeltaY});
});
};