2016-07-22 34 views
0

我在我的Ionic2項目中使用turn.js,當用戶從左向右滑動或向左滑動需要轉動。當我刷卡時如何觸發轉向?Turn.js左右揮動

file.ts

ngAfterViewInit() { 
    var winWidth = window.innerWidth; 
    var winHeight = window.innerHeight; 

    console.log(winWidth,winHeight); 

    jQuery("#flipbook").turn({ 
     width: winWidth, 
     height: winHeight, 
     display:'single', 
     zoom: 0, 
     turnCorners: "bl,br,tl,tr,l.r" 
    }); 
} 

回答

1

綁定到jQuery的swipeleft和swiperight事件,並呼籲turnjs轉方法。

jQuery(window).on("swipeleft", function(event) { 
     $('#flipbook').turn('next'); 
       }); 


jQuery(window).on("swiperight", function(event) { 
     $('#flipbook').turn('previous'); 
       }); 
+0

謝謝工作正常 – sridharan