我在Ionic2项目中使用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"
});
}
答案 0 :(得分:1)
绑定到jquery的swipeleft和swiperight事件,并在turnjs上调用turn方法。
jQuery( window ).on( "swipeleft", function( event ) {
$('#flipbook').turn('next');
} );
jQuery( window ).on( "swiperight", function( event ) {
$('#flipbook').turn('previous');
} );