hammer.js

Hammer.js can't remove event listener

痞子三分冷 提交于 2019-12-01 10:55:39
I create a hammer instance like so: var el = document.getElementById("el"); var hammertime = Hammer(el); I can then add a listener: hammertime.on("touch", function(e) { console.log(e.gesture); } However I can't remove this listener because the following does nothing: hammertime.off("touch"); What am I doing wrong? How do I get rid of a hammer listener? The hammer.js docs are pretty poor at the moment so it explains nothing beyond the fact that .on() and .off() methods exist. I can't use the jQuery version as this is a performance critical application. JSFiddle to showcase this: http://jsfiddle

Hammer.js can't remove event listener

一世执手 提交于 2019-12-01 07:57:05
问题 I create a hammer instance like so: var el = document.getElementById("el"); var hammertime = Hammer(el); I can then add a listener: hammertime.on("touch", function(e) { console.log(e.gesture); } However I can't remove this listener because the following does nothing: hammertime.off("touch"); What am I doing wrong? How do I get rid of a hammer listener? The hammer.js docs are pretty poor at the moment so it explains nothing beyond the fact that .on() and .off() methods exist. I can't use the

Hammer JS not working with backbone

▼魔方 西西 提交于 2019-12-01 05:47:39
I'm trying to get hammer js events working with backbone but can't get it to respond to events. I've tried the following already.. http://cijug.net/tech/2013/01/16/backbone-hammer/ https://gist.github.com/kjantzer/4279025 I've also put below piece of code in my view initialize: function(){ this.events = _.extend({}, this.defaultEvents, this.events||{}); } JS Fiddle : http://jsfiddle.net/XcYhD/ Code <div id="swiping"></div> JS AppView = Backbone.View.extend({ el: '#swiping', events: { 'swipe': 'swipeMe' }, render: function(){ this.$el.html('<h2>Swipe Me</h2>'); }, swipeMe: function(e){ alert(

Hammer JS not working with backbone

戏子无情 提交于 2019-12-01 02:16:31
问题 I'm trying to get hammer js events working with backbone but can't get it to respond to events. I've tried the following already.. http://cijug.net/tech/2013/01/16/backbone-hammer/ https://gist.github.com/kjantzer/4279025 I've also put below piece of code in my view initialize: function(){ this.events = _.extend({}, this.defaultEvents, this.events||{}); } JS Fiddle : http://jsfiddle.net/XcYhD/ Code <div id="swiping"></div> JS AppView = Backbone.View.extend({ el: '#swiping', events: { 'swipe':

Using mobile events in Angular2

两盒软妹~` 提交于 2019-11-30 07:27:06
问题 I was wondering if I could get some help in regards to events for mobile devices. I was looking around for a way to bind functions to swipe events in Angular 2. I saw in this this issue on Github that mentions that Angular 2 uses Hammer.js for mobile event handling. I'm having some trouble getting the event to work because I get the following error: EXCEPTION: Hammer.js is not loaded, can not bind swipeleft event A snippet of my code is below: import {Component, View, AfterContentInit} from

Configure Hammerjs events with angular2

别来无恙 提交于 2019-11-30 05:27:45
How can I configure hammerjs events in angular2? To use hammerjs events with angular2 I just have to include events on my html like this: <div (press)="onLongPress($event)"></div> In this case ( press ) will have time of 251 milliseconds, by default. Hammerjs press event documentation How do I configure this time to have different value? With Angular 2.0.1, there's actually a direct way to configure hammerjs: // app.module.ts import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '@angular/platform-browser'; export class MyHammerConfig extends HammerGestureConfig { overrides = <any>{ //

Configure Hammerjs events with angular2

馋奶兔 提交于 2019-11-29 03:57:55
问题 How can I configure hammerjs events in angular2? To use hammerjs events with angular2 I just have to include events on my html like this: <div (press)="onLongPress($event)"></div> In this case ( press ) will have time of 251 milliseconds, by default. Hammerjs press event documentation How do I configure this time to have different value? 回答1: With Angular 2.0.1, there's actually a direct way to configure hammerjs: // app.module.ts import { HammerGestureConfig, HAMMER_GESTURE_CONFIG } from '

Using mobile events in Angular2

淺唱寂寞╮ 提交于 2019-11-29 03:52:27
I was wondering if I could get some help in regards to events for mobile devices. I was looking around for a way to bind functions to swipe events in Angular 2. I saw in this this issue on Github that mentions that Angular 2 uses Hammer.js for mobile event handling. I'm having some trouble getting the event to work because I get the following error: EXCEPTION: Hammer.js is not loaded, can not bind swipeleft event A snippet of my code is below: import {Component, View, AfterContentInit} from 'angular2/core'; import {HelperService} from "./helper-service"; import {HammerGesturesPluginCommon}

Angular 2 - 'Could not find HammerJS'

ぐ巨炮叔叔 提交于 2019-11-28 16:56:15
I'm working on a simple angular2 project where I am trying to import Material Design into my project but some of the components aren't working properly and a console warning says: Could not find HammerJS. Certain Angular Material components may not work correctly. I have hammerjs installed and also @angular/material . How do I resolve this issue? My project can be found at this github repo Sidenote It may be worth noting that if you have hammerjs installed and your components are still not rendering correctly to make sure you are using angular material 2 components and not html elements with

Javascript touch movement, track when user swipes from edges

假装没事ソ 提交于 2019-11-28 00:41:23
问题 I need to track user touch events. I want to track when user swipes from edges. For example when user swipes from left vertical edge I will show a menu, from right edge make an alert, and show another menu when user swipes from top. I couldn't find a similar usage. How can I make this behaviour ? Tracking swipe from edges ? I tried this with hammer.js because I use jQuery, But other libraries (QuoJS, TouchSwipe, Touchy etc.) are ok for me. Fiddle: http://jsfiddle.net/mavent/ym4JV/51/ $