javascript - Hammer.js doesn't work -
I am using Hammer.js and I have included the Hummer and Hammer JCT plugin: < Pre> & lt; Script src = 'res / stat / js / hammer.js' & gt; & Lt; / Script & gt; & Lt; Script src = 'res / stat / js / jquery.hammer.js' & gt; & Lt; / Script & gt;
Now, with this code I am trying to get double tap to work:
The element with the classname 'snap_item' exists and the spelling is correct. The hammer. The path of the js and jquery plugin is also correct. I tested it on iPhone 5S and when I repeat the element, it does nothing.
Does anyone know what is going wrong here? I have a JQuery V2 that is also causing this problem?
Documents. GetElementsByClassName returns an array of elements. Hammer constructor can only take one element. Start it on your own:
var element = document.getElementsByClassName ('snap_item'); [] .slice.call (element). ForEach (work) {var hammertime = new hammer (element); hammertime.on ('duplication', function (event) {warning ('hello!');});}); JSFiddle demo:
Comments
Post a Comment