onSwipeX

occurs on a horizontal swipe movement

void onSwipeX(object start_context,object current_context);
start_context
objectobject with parameters of swipe event start current_context
objectobject with parameters of swipe event end

Example

webix.attachEvent("onSwipeX",function(start_context,current_context){
    //your code here
});

Details

Parameters of the start_context and current_context objects are given below:

To check whether the swipe direction is "from right to left" or "from left to right", you can calculate the difference between currentContext.x and startContext.x. If the difference is positive, swipe movement direction was "from left to right". In case of a negative value, the direction was "from right to left".

// example of usage
webix.attachEvent("onSwipeX",function(c1,c2){
   if( c2.x - c1.x > 0 ){
        // swipe from left to right
    }
   else{
       // swipe from right to left
   }
});
Back to top
Join Our Forum
We've retired comments here. Visit our forum for faster technical support, connect with other developers, and share your feedback there.