Giter Club home page Giter Club logo

ui-swipe-events's Introduction

SwipeEvents

SwipeEvents is a standalone library which help in detecting swiping actions on both mobile and desktop enviroments.

You can activate it on a target element:

addSwipeEvents('targetId');

then you can listen swipe events on that element:

var el = document.getElementById('targetId');
el.addEventListener('swipe', function(e) {
    alert('you swiped: ' + e.direction);
});

Config Options

touch

true|false set if to detect touch events

mouse

true|false set if to detect mouse events

directions

set wich swipe directions to detect and in wich priority.

all detect all directions with the following priority: left, right, up, down

h detect only left/right directions

v detect only up/down directions

left right up down detect a single direction

left, up custom set of directions

tolerance

set a tolerance for a swipe action to be detect. it is something like "you have to do XX pixel on left direction for a swipe event to be detected".

50 integer value set a pixel based tolerance to all directions

[50, 100] array of 2 values set vertical and horizontal tolerance

[50, 100, 150, 200] array of 4 values set a clockwise tolerance like in CSS: up, right, down, left

{up: 50, right: 100} set specific tolerance for each option with an object

ToDo

  • swipe detect a percentage swipeSize/containerSize, container should be given as fixed integer, DOM element or identifier
  • steps: should emit 'swipestep' at given size or percentage... like jQueryUI draggable grid option...
  • detect swipe from borders with some tolerance

ui-swipe-events's People

Contributors

marcopeg avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.