javascript - How Keyboard events of a desktop website are simulated in mobile website using jquery? -
i have function tied keyboard arrow keys events in desktop website using jquery. $(document).keydown(function(e) { switch (e.which) { case 37: //left doit("leftside"); break; case 38: //up doit("upside"); break; case 39: //right doit("rightside"); break; case 40: //down doit("downside"); break; } } these working fine on desktop website, not on mobile website. (i know can't access arrow keys in mobile) i want corresponding functions executed in mobile website. (if user swipes left/up/right/down on mobile website) can me in this? i don't think can this, swipes swipes combination of different events (i.e. keydown, keyhold, keyup) . picking swipes via keyup , keydown events can difficult. better use plugin can explicitly detect swipes such hammer.js