0

I am using turn.js in my Ionic2 project, when the user swipes from the left to right or right to the left page need to turn. How to trigger turn when I swipe?

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"
    });
}
SystemParadox
  • 8,203
  • 5
  • 49
  • 57
sridharan
  • 2,011
  • 10
  • 36
  • 61

1 Answers1

1

Bind to jquery's swipeleft and swiperight events and call turn method on turnjs.

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


jQuery( window ).on( "swiperight", function( event ) { 
        $('#flipbook').turn('previous');
               } );
dors
  • 1,152
  • 11
  • 19