Swipe handler, support all browser
npm install xwiper --save
import Xwiper from 'xwiper';
const xwiper = new Xwiper('.slider');
xwiper.onSwipeLeft(() => console.log('swipe left'));
xwiper.onSwipeRight(() => console.log('swipe right'));
xwiper.onSwipeUp(() => console.log('swipe up'));
xwiper.onSwipeDown(() => console.log('swipe down'));
xwiper.onTap(() => console.log('tap'));
// Remove listener
xwiper.destroy();
You can use element instance
const slider = document.querySelector('.slider');
const xwiper = new Xwiper(slider);