I am developing this small website: Website ; and I use HammerJS as a touch support library.
It seems to be responding to events, and it recognizes the event.type property, but when I try to get event.direction or other related properties with the drag event, nothing is output to the console (I am logging the results in the console).
This is how I listen to the drag event "
Application.ApplicationController.prototype.Drag = function(selector, delay, callback) { return $(selector).on('drag', _.debounce(function(event){ event.preventDefault(); return (typeof callback === 'function' && callback !== undefined) ? callback.apply( event, [ event ] ) : 'Argument : Invalid [ Function Required ]'; }, delay)); };
I call it something like:
this.Drag(selector, delay, function(event) { console.log(event.type, event.direction); });
Can someone tell me what I am doing wrong, or if something is missing?
EDIT: I just replaced the jQuery library: jquery.specialevents.hammer.js ; with old jquery.hammer.js ; and it seems that now he is reacting to all events, and I get all the properties that I should. However, I would like to know why I did not try to work with him?
EDIT: I found the root cause of my problem, my code depends on some libraries that I load asynchronously with the Yepnope script loader, so somewhere along the path instead of loading all the libraries (including the jquery plugin for hammer.js), some of them are lost: ) I fixed this problem and now events have properties that they should use.
Rolling
source share