Skip to content
This repository has been archived by the owner. It is now read-only.
[ABANDONED] Swipe function javascript/Jquery
JavaScript CSS HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
modules
oo-swipe-full
README.md
oo-swipe.js
oo-swipe.min.js

README.md

OO-Swipe Jquery plugin v 1.4.1

How to ?

  • Import Jquery and oo-swipe.js
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

<script type="text/javascript" src="oo-swipe.min.js"></script>
  • Create a div and call the function
  	<div id="foo">Swipe me !</div>
  	$(function() {
		$("#foo").swipe(function(e){
      		console.log(e);
    	},{
            returnRealTime : true,
            delayActive    : 250,
            distanceActive : 45,
        });
  	});
  1. First param: callback function.
  2. Second param: json.
    1. returnRealTime => true or false (true by default)
      • If True, return after each movement.
      • If False, return only on mouseUp/toucheEnd.
    2. delayActive => int (250 by default)
      • Time min in ms between mouseDown and mouseUp
    3. distanceActive => int (45 by default)
      • Distance min of swipe between mouseDown and mouseUp

Returned Object

{
    target:{
        selector: this['selector']
    },
    event: "mousemove", // mousemove/touchmove or mousedown/touchstart or mouseUp/touchend
    position: "x",      // x or y
    active: true,       // True or false
    x:{
        direction: "left", // Left or right
        dis      : 0,      // Always positive
        rDis     : 0       // Real distance (positive and negative)
    },
    y:{
        direction: "bottom", // Bottom or top
        dis      : 0,        // Always positive
        Rdis     : 0         // Real distance (positive and negative)
    },
    top   : 0,  // Distance to drag to top
    right : 0,  // Distance to drag to right
    bottom: 0,  // Distance to drag to bottom
    left  : 0   // Distance to drag to left
    ParentEvent  : [Object]  // Parent event object
};

Modules

/!\ All modules require jQuery and oo-swipe.js /!\

OO-SWIPEWINDOW.JS

    $("#parent").swipeWindow({
        item       : '.item',   // Childs selector
        position   : 'x',       // Position of dragging    (optional, x by default)
        mobileOnly : false,     // If only on mobile       (optional, false by default)
    });

OO-SWIPENAV.JS

    $("#menuNav").swipeNav({
        position   : 'left',    // Menu position                                    (optional, left by default)
        speed      : 100,       // Speed of closing or opening menu                 (optional, 100 by default)
        bgAnim     : true,      // If true, bg change color                         (optional, true by default)
        mobileOnly : false,     // If only on mobile                                (optional, false by default)
        borderDrag : 30,        // Width of the selection when the menu is closed   (optional, 30 by default)
        minDrag    : 100,       // Min drag to open or close the menu               (optional, 100 by default)
    });
You can’t perform that action at this time.