2014-12-12 29 views
1

要綁定的事件,如點擊與GQuery你可以這樣做:如何使用GWTQuery綁定觸摸事件?

@UiField 
Element myButton; 

... 

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

我需要的是觸摸事件,如接頭支持,因爲它是在MGWT實施。在MGWT您可以使用觸摸屏上,得到這樣的輕敲事件:

@UiField 
TouchPanel panel; 

... 

panel.addTapHandler(...); 

編輯:我需要的東西像下面這樣:

@UiField 
Element myButton; 

... 

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

有沒有綁定GQuery敲打事件的方式因爲它是爲TouchPanel完成的?

回答

3

我已經發布了我的用於觸摸手勢的插件的預覽,我不得不打磨一些與高級手勢相關的問題,但它的功能非常強大,只需輕點並輕掃即可。

插件是:https://github.com/manolo/gwtquery-gesture-plugin

還有一個現場演示:http://manolo.github.io/gwtquery-gesture-demo/index.html

您可以在演示Java代碼中找出用法:https://github.com/manolo/gwtquery-gesture-demo/blob/master/src/main/java/com/google/gwt/query/client/plugin/GestureSample.java

+0

這是偉大的!謝謝! – confile 2014-12-31 13:42:22