hammerjs / jquery.hammer.js Goto Github PK
View Code? Open in Web Editor NEWjQuery plugin for Hammer.js
License: MIT License
jQuery plugin for Hammer.js
License: MIT License
Hi there,
I was looking at the wrapper but I can't see where and how to pass the .add(pinch) to the manager. I'm also no good at JS syntax so that might be why.
Need to tag v1.0.0 so bower can find it. Here's the output from Bower currently:
bower jquery-hammerjs#~1.0.0 ENORESTARGET No tag found that was able to satisfy ~1.0.0
hi :)
i see that latest version of your great jquery hammer plugin is
for Hammer.JS - v1.0.6
but latest hammer version is Hammer.JS - v1.0.10
(im trying to upgrade to latest because of some issues im having with previous one)
Does your version work also with 1.0.10?
can i simply replace hammer code on top of the plugin with the 1.0.10 , would it then work?
thank you so much for your help
Hi,
I recently updated to most recent hammer.js and jquery.hammer.js . I was previously using jquery.hammer-full.js. There seem to be some major changes in usage that I am just feeling out. One significant change seems to be that there are no more methods in event.gesture like "stopPropagation" and "stopDetect" -- calling these will now return "undefined". Seeing this I thought I could use "stopPropagation" method in the top level event in order to stop a touch event from bubbling up the DOM like I would for any "standard" event. However, this doesn't seem to work:
http://jsfiddle.net/justinshea/4tL6xub1/
In the example you will notice that tapping on the innerbox will bubble to outerbox even though stopPropagation is called for tap event in innerbox..Not sure if this is an "issue" or if I am just missing something??? any/all feedback is appreciated...
Thanks,
Justin
No problem with 'drag' event.
The problem happens when you move from one event to another.
Hi there,
We noticed that your repo has a medium severity vulnerability:
Here is the test report for this repo.
If you’d like to fix this vulnerability, Snyk lets you generate a pull request that recommends the best upgrade path - there’s a link to fix this vulnerability on the test report.
Stay secure :-)
Snyk Community
I downloaded this but the event.html
example doesn't work because the hammer.js folder doesn't include the js/plugin folder
I am building a Single Page Application using Backbone, but I am I have a feeling I am implementing this incorrectly. I get the following errors:
"NetworkError: 404 Not Found - http://sd.local/js/hammerjs.js"
hammerjs.js (line (null))
Error: Script error for: hammerjs http://requirejs.org/docs/errors.html#scripterror
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
require.js (line 163)
My require config like this:
require.config({
paths: {
hammer: 'libs/plugins/hammer/hammer.min',
jqueryhammer:'libs/plugins/hammer/jquery.hammer.min'
}
});
The call to jquery.hammer
define([
'hammer',
'jqueryhammer'
], function (Hammer) {
'use strict';
//Calling the redner() function from this view will cause the above error.
Any idea how i can fix it? Thank you!
Strange error but I can't get jquery.hammer.js to work after being minified. I have tried using the supplied minified version, using uglify and uglify2. Using the non minified version produces no errors.
Tested on.
IE 8.0.6001.18702
Windows XP
Service Pack 3
hammer-full.min.js throws Object expected at line 7 character 779
var d=function w(a,b){return new w.Instance(a,b||{})};
replacing the above minified code with the following removes the exception.
var d=function w(a,b){return new w.Instance(a,b||{})};d=w;
original source line 29 hammer.js
var Hammer = function Hammer(element, options) {
return new Hammer.Instance(element, options || {});
};
se example file at https://dl.dropboxusercontent.com/u/9962821/hammerjs-ie8-bug.html
Hello,
Working on my website, I may have found what seems to be a bug (or a lack of knowledge :p)... ? In my testpage (http://www.soykje.com/testeur/), I wanted to have vertical swipe for mobile devices to navigate up and down, and horizontal swipe to toggle left and right sidebars.
I'm not a JS excerpt so maybe I missed something... But is there any problem in having for the same document horizontal and vertical swipe ?
Thank you !
Hi,
I've just noticed stopDefaultBrowserBehavior doesn't work at all. The trouble is here:
https://github.com/EightMedia/jquery.hammer.js/blob/master/jquery.hammer-full.js#L314
https://github.com/EightMedia/jquery.hammer.js/blob/master/jquery.hammer-full.js#L321
https://github.com/EightMedia/hammer.js/blob/master/hammer.js#L310
"value" argument is missing. Sorry, I have no possibility to make a pull request at the moment.
bower.json is listing hammerjs (github.com/EightMedia/hammer.js) as a dependency. Shouldn't it be listing hammer.js (github.com/hammerjs/hammer.js)?
I get a duplicate component when installing jquery.hammer.js while already have hammer.js installed.
Hi guys cant find jquery hammer full version i.e. the all in one jquery wrapper and hammer script?
I know how to enable vertival swipe in hammer.js way.
but if I want to use jquery.hammer.js, how can I enable vertical swipe?
Each time I try to initialize my element with .hammer()
.
Any clue?
Example: http://jsbin.com/duqurahaculu/1/edit?html,js
Open up the Dev tools on Chrome
There was a related pull request #39 that was closed with 0 discussion. Hammer handles this correctly it appears that the jquery plugin has a bug.
Regarding the README.md:
As stated in the official documentation of bind(), on() should be used instead:
As of jQuery 3.0, .bind() has been deprecated. It was superseded by the .on() method for attaching event handlers to a document since jQuery 1.7, so its use was already discouraged. Link
Hey there -
I tried pulling in the npm module npm install jquery-hammerjs --save
and noticed that the standalone files were not included. Is this intentional? Are there plans to add them?
thanks,
-matt
Hi
An Update of jquery.hammer-full.min.js to Version 2.01 would be great
Sometimes I get the error:
Uncaught TypeError: Cannot read property 'timeStamp' of undefined
In this line: https://github.com/EightMedia/jquery.hammer.js/blob/4ccab20ce569e1fe257d48860858d8bf4421a19c/jquery.hammer-full.js#L1310
It happens when I finish dragging a sidebar (holding a button that has a tap event) and quickly click another button that has a tap event.
Replacing:
since_prev = prev && ev.timeStamp - prev.lastEvent.timeStamp;
with
since_prev = prev && prev.lastEvent && ev.timeStamp - prev.lastEvent.timeStamp;
solves the issue.
Was updating my packages.
Updating from 1.1.2 -> 1.1.3 was all good.
Updating from 1.1.3 -> 2.0.0 causes the hammer
function to disappear.
$(element).hammer().bind('event', handler)
ceases working where $(element).hammer().on('event', handler)
had worked previously.
Am I missing something? Did the API change further? Do I need to separately include another package?
I'd like to be able to bind few events to one function. Something like this:
$e.hammer().bind(['swipeleft','panleft'], function (event) {
$(event.target).carousel('next');
});
Hi. I''m implementing hammer 2 to manage pressup and tap event on table rows. Everything works fine but I get an issue. This is my code:
$('#grid_in').hammer({time: 1000, domEvents: true}).on('pressup', 'tr', function () {
$(this).addClass('row-selected');
})
$('#grid_in').hammer({domEvents: true}).on('tap', 'tr:not(.row-selected)', function () {
$(this).removeClass('row-selected');
});
So if I press for just a few time, the class is added and then immediately removed: it looks like pressup fires even if I press for less a second. What do I am missing?
Thank you for your help.
Right now the plugin doesnt support proper include via Browserify (through npm).
please check fiddle
http://jsfiddle.net/2f9zgqc2/
No matter where I look, there is hardly anything on how to use this damn framework. Everything is so vague and they hardly explain how to implement this stuff. I simply want to add one swipe function to a HTML object. But I can't find ANY useful resources and it's so annoying. I have gone from the Hammer.js, to Hammer.min.js to the jquery.hammer.js and every single one of them has given me a error. Either saying Hammer is not defined or a addeventlistener is not a function - hammer js.
Just make ONE simple tutorial on how to implement the framework. We aren't all well-experienced coders. Everyone just assumes you can just figure it out with a one line explanation of -
"It’s easy to use, just include the library and create a new instance. -
var hammertime = new Hammer(myElement, myOptions);
hammertime.on('pan', function(ev) {
console.log(ev);
});"
Ok.. so I do that but then it's the same damn errors haha.
Hi,
I am a developer of touchscreen apps that are html based and i really need pay attention to on and off events.
i tested this function in the new version of hammer, and as far as i can say it´s not working, index is always false.
In versions v1.0.6dev works really good.
This is what i normally do: node.obj.off(node.event, node.callback);
off: function offEvent(gestures, handler) {
var self = this;
console.log("gestures :: ", gestures);
console.log("handler :: ", handler);
Event.off(self.element, gestures, handler, function(type) {
var index = Utils.inArray({ gesture: type, handler: handler });
console.log("index :: ", index);
if(index !== false) {
self.eventHandlers.splice(index, 1);
}
});
return self;
In this jQuery version, how can I create a secondary swipe, with 2 fingers in addition to the existing swipe with 1 finger?
/*! Hammer.JS - v1.1.3 - 2014-05-22
* http://eightmedia.github.io/hammer.js
*
* Copyright (c) 2014 Jorik Tangelder <[email protected]>;
* Licensed under the MIT license */
jquery.hammer-full.js
In IE7 and IE8,
$("#div").hammer(hammer_options).on("dragstart", function (ev) {
dragStartX = ev.gesture.deltaX, dragStartY = ev.gesture.deltaY;
})
Got error:
'gesture.deltaX' is null or not an object
which plugin should we all be using? is the other plugin at
https://github.com/hammerjs/jquery.hammer.js
the now official one?
When using RequireJS Optimiser the Optimiser output the following message regarding jquery-hammerjs.
vendor/jquery-hammerjs/jquery.hammer.min.js has more than one anonymous define. May be a built file from another build system like, Ender. Skipping normalization.
its seems doesn't work correctly
It will disable jQuery.UI.draggable in case of such a code:
sp.draggable().hammer()
On the other hand, events of hammer.js don't fire in case of this:
sp.hammer().draggable()
But, in v1.0.5 - 2013-04-07, all events had fired.
I am trying to implement an event handler on the body element that is targeted to sub-elements with a selector. In the below example, the click handler works because jQuery allows you to filter for child elements on the click handler, but the handler for hammer does not.
$("body").on("click", "[data-evo-overlay-toggle]", toggleOverlay );
$("body").hammer().on("swiperight", "[data-evo-overlay-swiperight]", toggleOverlay);
It would be nice to have support for filtering.
Hello there,
It seems hammer cannot bind on a multiple selector, i.e. $("#id1,#id2").hammer()...
Here's the code: http://jsfiddle.net/1qacj0ct/2/
Here's the screen recording: https://www.dropbox.com/s/7q0185j4ikgcw9z/hammerjs-bug.mp4?dl=1
Thanks 👍
From what I have tested its not possible to use off() without any arguments?
$(element).hammer().off(); // not possible
$(element).hammer().off('tap'); // possible
I would like the off to work like explained on jQuery documentation:
Calling .off() with no arguments removes all handlers attached to the elements. Specific event handlers can be removed on elements by providing combinations of event names, namespaces, selectors, or handler function names. When multiple filtering arguments are given, all of the arguments provided must match for the event handler to be removed.
I was getting jquery-hammerjs using Bower ("jquery-hammerjs": "*"). It downloaded file jquery.hammer.js to hammerjs folder. I then used RequireJS (with jquery injected using shim config) to load the plugin.
After the latest release things changed and now Bower downloads two folders (hammerjs, and jquery-hammerjs). I can't figure out how to load the plugin now with RequireJS. Any hints on what the changes are about and what is the recommended approach to use it with AMD loader?
Will this plugin be updated to Hammer 2.0?
In Node.js, require('jquery')
will instead return a jQuery factory that requires a window, thus jquery.hammer.js breaks, as it expects jQuery to be loaded.
We test our GUI on Node.js with jsdom and we'd like this to work.
It also doesn't make much sense to depend on jQuery. This makes you bring your own version of jQuery, bloating the size of a Browserify bundle. It also attaches your plugin to your copy of jQuery, as opposed to a version of jQuery our code is using.
It is much better to use peer dependencies to hint what jQuery you need,
and then take window or jQuery as a parameter or at least rely on jQuery as a global.
Would you be open to big API changes in your module to fix these problems?
It may force you to bump the major version again, but otherwise this module is currently unusable in Node.js and with Browserify, in my opinion.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.