Skip to content

Lochlan/simple-swipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-swipe.js

SimpleSwipe provides a JavaScript interface for handling basic one-finger swiping on touch screens. The code, which began as a refactoring of padilicious.com's swipe code, is short and (hopefully) easy to understand. It was written for projects that don't need things like pinch zoom or multi-finger swiping, and don't necessarily want large libraries like jQuery mobile or TouchSwipe.

Usage

Attach swipe listeners:

var s = new SimpleSwipe(element,
    function (swipe, element) {
        console.log('swipe move', swipe);
    }, function (swipe, element) {
        console.log('swipe end', swipe);
    });

The callbacks fire on the touchmove and touchend events respectively. Note that the context for the this keyword inside the callbacks is the SimpleSwipe object

Remove swipe listeners:

s.removeListeners();

That's it!

For more details take a look at the code or view an example.

Build Tools

A makefile-based build system is provided to ease development. It requires node.js, npm, and (of course) GNU Make. Once those are installed, run make in your shell to install node packages and then lint and minify the code. See the makefile for details.

About

👆 Basic one-finger swiping for your website

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published