chriswessels / ember-hammer

ember-hammer is a neat interface for defining Hammer.js gestural behaviour in your Ember.js Views.

Home Page:https://github.com/chriswessels/ember-hammer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how can i use it in a template?

MitkoTschimev opened this issue · comments

Hi ;)

Is there something like a helper for handlebars?
Or how can i register a tap to an element.

Best regards

Hi @tfiwm,

In order to attach touch behaviour to an element, you need have that element represented by a Ember.View object. You can then attach behaviour to it like so:

import Ember from 'ember';

export default Ember.View.extend({
  hammerOptions: {
    swipe_velocity: 0.5
  },
  gestures: {
    swipeLeft: function (event) {
      // do something like send an event down the controller/route chain
      return false; // return `false` to stop bubbling
    }
  }
});

Look here for help with understanding views: http://emberjs.com/guides/views/

Chris