I have been trying to implement swipe in mobile for a webapp and can't use jquery or touch events due to some restrictions. Is there any other way to achieve the swipe without jquery or touch events which includes hammerjs as well. Thanks in advance.
Asked
Active
Viewed 256 times
1
-
Of course it is. But it will be a lot of coding here. – kind user Nov 22 '16 at 13:41
-
@KevinKloet I have tried Hammerjs, Swipejs and touch event and jquery. – Apoorva Nov 22 '16 at 13:45
-
@K.Daniek How much coding are we talking about? I mean it's just a nav bar swipe, it shouldn't have a lot of code for just a navbar swipe in mobile. – Apoorva Nov 22 '16 at 13:46
-
so... you want to capture a touch event without the use of a event? – Kevin Kloet Nov 22 '16 at 13:46
-
@KevinKloet Apparently, yes. – Apoorva Nov 22 '16 at 13:47
-
think about your question, how would one detect an event without using eventhandlers? if you change your mind, [here](http://stackoverflow.com/questions/2264072/detect-a-finger-swipe-through-javascript-on-the-iphone-and-android#answer-23230280) is a native javascript solution. – Kevin Kloet Nov 22 '16 at 13:50
-
@KevinKloet Cool Kevin. Also, a stupid question, will it be compatible with reactjs? – Apoorva Nov 22 '16 at 13:53
-
yes reactjs is a library for javascript so it doesn't replace javascript. – Kevin Kloet Nov 22 '16 at 13:54
-
Great, then I shall try and let you know how it panned out. Thanks again. Also, please take a look at this link too: http://codepen.io/zvona/pen/avYgJg?editors=011 – Apoorva Nov 22 '16 at 13:58
1 Answers
0
So, I found a hack that could possibly solve the issue. Instead of using any type of touch events, for horizontal scroll, we can use the following code on the stylesheet of container div:
overflow-x: scroll;
overflow-y: hidden;
-webkit-overflow-scrolling: touch;
behaviour: ‘smooth’;
Pros: 1. Controlled speed 2. Easy touch scroll 3. Faster implementation 4. Less functionality weight on the site

Apoorva
- 123
- 1
- 1
- 8