earlier in handleSwipe blocks if condition x was taken which results in ...

...only swipe left and not swiperight as to calculate x value Math.abs function was used. To remove it i hav replace the x with the code. This now works fine