滑动时打开导航抽屉(Material Design Lite)

Isa*_*acm 8 javascript jquery swipe-gesture material-design-lite

我正在使用Material Design Lite在Web视图中为应用程序创建UI但是我遇到了一个问题,我无法在滑动时部署导航抽屉.

我正在使用此jquery代码来识别滑动事件

  $(function() {      
      $("#test").swipe( {
        //Generic swipe handler for all directions
        swipeRight:function(event, direction, distance, duration, fingerCount) {
          $(this).text("Event Triggered" );  
        },
      });
    });
Run Code Online (Sandbox Code Playgroud)

从这里我不知道如何打开导航抽屉.我更希望整个屏幕"可以滑动",尤其是左边缘.触发此滑动处理程序时,如何打开导航栏?

小智 0

我试图在演示材料设计精简版中添加此效果,http://www.getmdl.io/templates/dashboard/index.html。所以我找到的解决方案是通过Material Design lite生成的类“mdl-layout__drawer-button”来模拟汉堡按钮的点击事件。

$(function() {      
    $("#test").swipe( {
        //Generic swipe handler for all directions
        swipeRight:function(event, direction, distance, duration, fingerCount) {
            $(".mdl-layout__drawer-button").click();                        
        },
    });
});
Run Code Online (Sandbox Code Playgroud)