About Swipeable Mixin
This mixin adds touch swipe gesture detection to any web component. It supports directional swipes (left, right, up, down) with customizable sensitivity and timing. Perfect for mobile-friendly interfaces and gesture-based interactions.
๐ก Tip: On desktop, you can use mouse drag gestures instead of touch swipes! The settings are optimized for both mobile and desktop use.
๐งช Simple Test
Try swiping this red box first to test basic functionality (use touch on mobile or mouse drag on desktop):
Simple Test Element
Touch/swipe or mouse drag this red box to test basic functionality (min distance: 1px)
๐ฏ Interactive Swipe Demo
Try swiping in different directions on the container below:
Swipe Me!
Use touch gestures to interact with this element
โ๏ธ Swipe Settings
๐ Swipe History
๐จ Multiple Swipeable Elements
Card 1
Swipe to interact
Card 2
Different behavior
๐ Implementation Guide
How to Use the Swipeable Mixin:
1. Use the element: <swipeable-mixin>...content...</swipeable-mixin>
2. Set optional attributes: min-swipe-distance
, max-swipe-time
3. Listen for the swipe
event on the element to handle swipes in your code
โจ Features
What the Swipeable Mixin Provides:
- Directional Detection: Detects left, right, up, and down swipes
- Customizable Sensitivity: Adjustable minimum distance and maximum time
- Touch Support: Works on mobile devices and touch-enabled screens
- Event Dispatching: Automatically dispatches custom swipe events
- Performance Optimized: Efficient touch event handling
- Easy Integration: Simple mixin pattern for any component