1.0.0 • Published 6 years ago
swipie v1.0.0
SWIPIE - lightweight library to interact with touch and mouse move events
1. Functionality
Adding custom intuitive methods:
- swipe.up
- swipe.down
- swipe.left
- swipe.right
2. Usage
Install: npm i swipie
or yarn add swipie
- Row HTML:
<script src="/path/to/swipie.min.js"></script>
- ES6 Modules:
import 'swipie';
- CommonJS style
require('swipie')
No additional installations or additional configuration. Just import the module or include script and voila!
3. Example
<body>
<!-- Create elements -->
<div id="element1" style="width: 300px; height: 300px; background: #ddd; user-select: none;"></div>
<div id="element2" style="width: 300px; height: 300px; background: #0f0; user-select: none;"></div>
<!-- Load swipie library -->
<script src="../dist/swipie.js"></script>
<!-- Custom script -->
<script>
// Find elements to interact
const element1 = document.getElementById('element1')
const element2 = document.getElementById('element2')
//add swipie specific listeners
element1.addEventListener('swipe.up', () => console.log(`swiped up e1`))
element2.addEventListener('swipe.up', () => console.log(`swiped up e2`))
//ENJOY =)
</script>
</body>
4. LICENCE
MIT
1.0.0
6 years ago