Skip to content

jeremili/js_touch_swipe_function

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 

Repository files navigation

js_touch_swipe_function

A simple Javascript function to handle swipe action

This function allow you to handler basic swipe action (left, right, up, down) on mobile screen.

You can define parameter to the swipe function :

  • element where the swipe action is listen
  • delta : when the detection start

You must define a callback function which one listen action (left, right, up, down)

/**
* @param1 - DOM element or custom querySelector
* @param2 - delta when detection "start"
* @param3 - callback function
**/
 
 swipe('*', 0, function(e) {
    switch (e) {
        case 'left':
            /** do something **/

            break;
        case 'right':
            /** do something **/
            
            break;
        case 'up':
            /** do something **/
            
            break;
        case 'down':
            /** do something **/
            
            break;
    }

About

A simple Javascript function to handle swipe action

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published