How to bind Touch Events with GWTQuery?

229 views Asked by At

To bind events like click with GQuery you can do something like:

@UiField
Element myButton;

... 

$(myButton).on("click", new Function() {
  @Override
  public void f() {
    // event is triggered
  }
}

What I need is support for touch events like Tap as it was implemented in MGWT. In MGWT you can use a TouchPanel to get a tap event like this:

@UiField
TouchPanel panel;

...

panel.addTapHandler(...);

Edit: I need something like the following:

@UiField
Element myButton;

... 

$(myButton).on("tap", new Function() {
  @Override
  public void f() {
    // event is triggered
  }
}

Is there a way to bind a tap event with GQuery as it is done for the TouchPanel?

1

There are 1 answers

0
Manolo Carrasco Moñino On BEST ANSWER

I have released a preview of my plugin for touch gestures, I have to polish a little bit some issues related advanced gestures but it's quite functional with tap and swipe.

Plugin is at: https://github.com/manolo/gwtquery-gesture-plugin

There is also a live demo: http://manolo.github.io/gwtquery-gesture-demo/index.html

You can figure out the usage in the demo java code: https://github.com/manolo/gwtquery-gesture-demo/blob/master/src/main/java/com/google/gwt/query/client/plugin/GestureSample.java